Arrays Flashcards

practice coding questions

1
Q

cRemove duplicate values form an array => [“Apple”, “Mango”, “Mango”, “Banana”]

A

let arr = [1,2,2,3]
let new_arr = […new Set(arr)]
console.log(new_arr)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

To find if the word is palindrome

A

let word = “wow”
let newWord = word.split(“”).reverse().join(“”)
console.log(newWord)
if(newWord != word){
console.log(“is not palindrome”);

}
else{
console.log(“is palindrome”)
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly