pull/748/merge
muha 2 years ago committed by GitHub
commit a72cc6efb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -3,7 +3,7 @@ let string = 'love'
let patternOne = /love/ // with out any flag
let patternTwo = /love/gi // g-means to search in the whole text, i - case insensitive
string.match(substring)
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
let strings = 'I love JavaScript. If you do not love JavaScript what else can you love.'
console.log(string.match('love')) //
/*
output

Loading…
Cancel
Save