1var myString = "string test";
2var stringLength = myString.length;
3
4console.log(stringLength); // Will return 11 because myString
5// is 11 characters long...
1var colors = ["Red", "Orange", "Blue", "Green"];
2var colorsLength=colors.length;//4 is colors array length
3
4var str = "bug";
5var strLength=str.length;//3 is the number of characters in bug
1/* The length property of a String object contains the length of the
2string, in UTF-16 code units. length is a read-only data property of
3string instances. */
4
5const str = "Life, the universe and everything. Answer:";
6console.log(`${str} ${str.length}`);
7// expected output: "Life, the universe and everything. Answer: 42"