Skip to content

Instantly share code, notes, and snippets.

@nicco88
Last active June 2, 2017 03:32
Show Gist options
  • Save nicco88/24a5ff79a17962ce8b6912ea6448e2c7 to your computer and use it in GitHub Desktop.
Save nicco88/24a5ff79a17962ce8b6912ea6448e2c7 to your computer and use it in GitHub Desktop.
JS notes
var stringOne = "Hey there, how are you doing?",
stringTwo = "I'm doing great, thank you!";
// charAt() → it outputs the indicated index
console.log(stringOne.charAt(0));
// charCodeAt() → it returns the unicode number
console.log(stringOne.charCodeAt(0));
// concat() → it concatenates two or more strings
console.log(stringOne.concat(" ", stringTwo));
// endsWith() → it returns a boolean
console.log(stringOne.endsWith("doing?"));
// String.fromCharCode() → it returns the corresponding character
console.log(String.fromCharCode(114));
// includes() → it returns a boolean
console.log(stringOne.includes("you"));
// indexOf() → it returns the number value of the first element that matches
console.log(stringOne.indexOf("there")); // → 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment