added startsWith

pull/748/head
muha 2 years ago
parent 65e85f642b
commit 93ea0d3edc

@ -5,7 +5,11 @@
<title>30DaysOfJavaScript</title>
</head>
<body>
<body>// Variables can also be declaring in one line separated by comma
let name = 'Asabeneh', //name of a person
job = 'teacher',
live = 'Finland'
<h1>30DaysOfJavaScript:02 Day</h1>
<h2>Data types</h2>

@ -4,9 +4,11 @@ let string = 'JavaScript'
let firstLetter = string[0]
console.log(firstLetter) // J
let secondLetter = string[1] // a
let thirdLetter = string[2]
let lastLetter = string[9]
let thirdLetter = string[2]//v
let lastLetter = string[9]//a
console.log(lastLetter) // t
let lastIndex = string.length - 1
let lastIndex = string.length //will return the number of charactere that
console.log(lastIndex) // 9
console.log(string[lastIndex]) // t

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

@ -4,4 +4,4 @@ string.charCodeAt(index)
let string = '30 Days Of JavaScript'
console.log(string.charCodeAt(3)) // D ASCII number is 51
let lastIndex = string.length - 1
console.log(string.charCodeAt(lastIndex)) // t ASCII is 116
console.log(string.charCodeAt(lastIndex)) // t ASCII is 116

@ -1,6 +1,6 @@
// concat(): it takes many substrings and creates concatenation.
// string.concat(substring, substring, substring)
let string = '30'
console.log(string.concat("Days", "Of", "JavaScript")) // 30DaysOfJavaScript
console.log(string.concat(" Days", " Of", " JavaScript")) // 30DaysOfJavaScript
let country = 'Fin'
console.log(country.concat("land")) // Finland
console.log(country.concat(" land")) // Finland

@ -8,4 +8,13 @@ console.log(string.endsWith('in this world')) // true
let country = 'Finland'
console.log(country.endsWith('land')) // true
console.log(country.endsWith('fin')) // false
console.log(country.endsWith('Fin')) // false
// StartsWith is a helper function that takes a string and it returns a boolean value
let verb = 'Here you can'
console.log(verb.startsWith('Here')) // true
//@is there startwith

Loading…
Cancel
Save