javascript how to check length of string code example Example: js string length let str = "foo"; console.log(str.length); // 3