String Concatenation

Video

JavaScript Notes

JavaScript
    /**
     * The ways to concatenate Strings in JavaScript
     *
     */
    
    let greeting = "Howdy";
    let name = "Buzz";
    let str, str1, str2;
    
    // 1. concatenation operator
    str = greeting + " " + name + ".";
    
    // 2. String.prototype.concat method
    str1 = greeting.concat(" ", name, ".");
    
    // 3. ES6 Template strings, using backtick characters
    str2 = `${greeting} ${name}.`;
    
    console.log(str, str1, str2);