This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new string | |
const sentence = "How Do yOu feEl about chANGing the WoRLD" | |
// Create search expression | |
const regex = /[a-z]/g; | |
// Find matching strings | |
let lowerCaseLetters = sentence.match(regex) | |
// Display strings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New name | |
const name = 'Sean Paul'; | |
// Search term | |
const firstName = 'Sean'; | |
// Verify and display name if the firstname matches the search term | |
if(name.startsWith(firstName)){ | |
console.log(name) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a string and a search item | |
const sentence = "the lazy brown fox just couldn't move" | |
const keyWord = "the" | |
// Verify start word | |
let checkFirstWord = sentence.startsWith(keyWord) | |
// Display result | |
console.log(checkFirstWord) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create two variables with words | |
const word = 'Please'; | |
const greeting = 'Hello'; | |
// Convert the words to lower case | |
const lowercaseWord = word.toLowerCase(); | |
const lowercaseGreeting = greeting.toLowerCase(); | |
// Compare equality and display result | |
console.log(lowercaseWord === lowercaseGreeting); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New password string | |
const password = "Tunechi4LifE" | |
// Convert to lower case | |
const convertedPassword = password.toLowerCase() | |
// Display lower case password | |
console.log(convertedPassword) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create new password | |
const password = 'p@ssword'; | |
// Verify password length | |
if(password.length < 8){ | |
console.log('Your password is weak') | |
}else{ | |
console.log("Strong password selected") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New string | |
const word = "accessibility" | |
// Find the length of the word | |
let lengthOfWord = word.length | |
// Display length | |
console.log(`${word} has ${lengthOfWord} letters in it`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const username = ' Paul '; | |
const password = ' p@ssw0rd '; | |
const trimmedUser = username.trim(); | |
console.log(trimmedUser); | |
const trimmedPass = password.trim(); | |
console.log(trimmedPass); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample bulky sentence | |
let sentence = " scotchy scotch " | |
// trim sentence | |
let trimmedSentence = sentence.trim() | |
// display output | |
console.log(trimmedSentence) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New sentence | |
const sentence = 'Friday is the last day'; | |
// Keyword to be searched for | |
const day = 'Friday'; | |
// Find index of keyword | |
const hasDay = sentence.indexOf(day); | |