JavaScript strings



examples/javascript/strings.js
name = 'The black cat climbed the green tree';
console.log(name);
console.log(name.length);       // 36
console.log(name[1]);           // h

console.log(name.substr(4, 5)); // black

console.log(name.indexOf('black')); // 4
console.log(name.indexOf('dog'));   // -1

console.log(name.indexOf('e'));     // 2
console.log(name.lastIndexOf('e')); // 35