Array Join and String Split

Video

JavaScript Notes

JavaScript
    // Converting Strings to Arrays and Arrays to Strings
    // String to Array str.split()
    // Array to String arr.join();
    
    let sentence = "Hello my name is Inigo Montoya";
    let words = sentence.split(" ").sort(); // creates an array
    let hyphenated = words.join("-"); // creates a string
    
    sentence.split(" ").sort().join(" ");