Skip to content

Instantly share code, notes, and snippets.

@hustKiwi
Created September 21, 2019 08:08
Show Gist options
  • Save hustKiwi/6f07f5716f4709883dafa6c67d7f1d0f to your computer and use it in GitHub Desktop.
Save hustKiwi/6f07f5716f4709883dafa6c67d7f1d0f to your computer and use it in GitHub Desktop.
const str = 'Lesson 1';
str.length; // 8
str.charAt(1); // 'e'
str.concat(' - HTML Basics') // "Lesson 1 - HTML Basics"
str.includes('1') // true
str.endsWith('on 1') // true
str.startsWith('Les') // true
str.indexOf('s') // 2
str.indexOf('ss') // 2
str.indexOf('sss') // -1
str.split(' ') // ["Lesson", "1"]
str.slice() // 'Lesson 1'
str.slice(1) // 'esson 1'
str.slice(3, 5) // 'so'
str.slice(-4) // 'on 1'
str.substring(3, 5) // 'so'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment