added comment

pull/325/head
pradeep@marensolutions.com 3 years ago
parent 8b4f5a7e8c
commit 39578fce0b

@ -1,5 +1,5 @@
// charAt(): Takes index and it returns the value at that index // charAt(): Takes index and it returns the value at that index
string.charAt(index) // string.charAt(index)
let string = '30 Days Of JavaScript' let string = '30 Days Of JavaScript'
console.log(string.charAt(0)) // 3 console.log(string.charAt(0)) // 3
let lastIndex = string.length - 1 let lastIndex = string.length - 1

@ -1,6 +1,6 @@
// charCodeAt(): Takes index and it returns char code(ASCII number) of the value at that index // charCodeAt(): Takes index and it returns char code(ASCII number) of the value at that index
string.charCodeAt(index) // string.charCodeAt(index)
let string = '30 Days Of JavaScript' let string = '30 Days Of JavaScript'
console.log(string.charCodeAt(3)) // D ASCII number is 51 console.log(string.charCodeAt(3)) // D ASCII number is 51
let lastIndex = string.length - 1 let lastIndex = string.length - 1

@ -1,6 +1,6 @@
// indexOf(): Takes takes a substring and if the substring exists in a string it returns the first position of the substring if does not exist it returns -1 // indexOf(): Takes takes a substring and if the substring exists in a string it returns the first position of the substring if does not exist it returns -1
string.indexOf(substring) // string.indexOf(substring)
let string = '30 Days Of JavaScript' let string = '30 Days Of JavaScript'
console.log(string.indexOf('D')) // 3 console.log(string.indexOf('D')) // 3
console.log(string.indexOf('Days')) // 3 console.log(string.indexOf('Days')) // 3

Loading…
Cancel
Save