This a repository for JavaScript questions to get you comfortable answering interview questions for junior role
Implement a pangram check function.
A pangram or holoalphabetic sentence is a sentence using every letter of a given alphabet at least once.Read more
example: "The quick brown fox jumps over the lazy dog"
console.log(isPangram("The quick brown fox jumps over the lazy dog")) // true
console.log(isPangram("This sentence is not a pangram")) // false
- Spaces and Capitalisation in the sentences
.split() .join() .sort() .toLowerCase()
const alphabet= 'abcdefghijklmnopqrstuvwxyz'
Implement a palindrom check function
A palindrom is a word, number, phrase, or other sequence of characters which reads the same backward as forward Read more
example: madam or racecar
console.log(isPalindrome("racecar") //true
console.log(isPalindrome("avocado") //false
- This can be a single word or a sentence, they may contain capital letters and lowercases
.split() .reverse() .toLowerCase()
** for loop** comprehension This is to test your understanding of for loop
//Given array numbers =[1,2,3,4,5,6,7,8,9]
//Using only for loop print number from the last number to the first in the array
//Should print this in the console 9 8 7 6 5 4 3 2 1
using every check if evry person in the array is over age( 18 and above) or use some to check if the array contains anyone under age
using filter go through the array of random people and return people whose age is over 18 only and store them in a const variable overAge
using map change every person.drinks property in overAge to true and console log to check your answer
using findIndex return the index of the oldest person and their name and age
using reduce Calculate the average age of the array elements
using forEach print everyone's name and city they are from
let people=[
{
name: "Didier",
age: 26,
city: "Sydney",
drinks: false
},
{
name: "Hermes",
age: 27,
city: "Napoli",
drinks: false
},
{
name: "Abi",
age: 30,
city: "Orange",
drinks: false
},
{
name: "Mathis",
age:5,
city: "Los Angeles",
drinks: false
},
{
name: "kai",
age: 17,
city: "Atlantis",
drinks: false
},
{
name: "Jack",
age: 40,
city: "Liverpool",
drinks: false
}
]
Implement isIsogram function
A isIsogram is a word, phrase, or sentence in which no letter of the alphabet occurs more than once. The terms Heterogram and nonpattern word have also been used to mean the same thin Read more
example: ambidextrous
console.log(isIsogram("ambidextrous") // true
console.log(isIsogram("didier") // false
- This can be a single word or a sentence, they may contain capital letters and lowercases
.split() .toLowerCase() set
Implement isLeapYear function
- Leap Years are any year that can be exactly divided by 4 (such as 2016, 2020, 2024, etc)
- except if it can be exactly divided by 100, then it isn't (such as 2100, 2200, etc)
- except if it can be exactly divided by 400, then it is (such as 2000, 2400) read more
console.log(isLeapYear("2020")); // true
console.log(isLeapYear("2018")); // false
console.log(isLeapYear("1700")); // false
console.log(isLeapYear("1600")); // true