added startsWith

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

@ -5,7 +5,11 @@
<title>30DaysOfJavaScript</title> <title>30DaysOfJavaScript</title>
</head> </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> <h1>30DaysOfJavaScript:02 Day</h1>
<h2>Data types</h2> <h2>Data types</h2>

@ -4,9 +4,11 @@ let string = 'JavaScript'
let firstLetter = string[0] let firstLetter = string[0]
console.log(firstLetter) // J console.log(firstLetter) // J
let secondLetter = string[1] // a let secondLetter = string[1] // a
let thirdLetter = string[2] let thirdLetter = string[2]//v
let lastLetter = string[9] let lastLetter = string[9]//a
console.log(lastLetter) // t 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(lastIndex) // 9
console.log(string[lastIndex]) // t console.log(string[lastIndex]) // t

@ -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 @@
// concat(): it takes many substrings and creates concatenation. // concat(): it takes many substrings and creates concatenation.
// string.concat(substring, substring, substring) // string.concat(substring, substring, substring)
let string = '30' let string = '30'
console.log(string.concat("Days", "Of", "JavaScript")) // 30DaysOfJavaScript console.log(string.concat(" Days", " Of", " JavaScript")) // 30DaysOfJavaScript
let country = 'Fin' 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' let country = 'Finland'
console.log(country.endsWith('land')) // true console.log(country.endsWith('land')) // true
console.log(country.endsWith('fin')) // false 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