String Exercises

let str = "cat"; console.log(str[0]);

let str = "cat"; console.log(str.length);

let an = 'lion'; an = an[0] + an[1] + an[2] +an[3].toUpperCase() console.log(an);

let variableAmount = 100;

if(variableAmount === 1000000) { console.log(variableAmount + "dollars" + "(pinky)") } else { console.log(variableAmount + " dollars") }

let verbing = "go";

if(verbing.slice(verbing.length - 3) === "ing") { console.log(verbing + "ly") } else if( verbing.length < 3) { console.log(verbing) } else {

console.log(verbing + 'ing') }

  1. Create a withoutLast code block that takes a single string variable, and returns a copy of the string without the last

let str = "light";

let withOutLast = str.slice(0, [str.length - 1])

console.log(withOutLast);