10 Important JavaScript Coding Interview Questions
Reverse a String: Write a function that takes a string as input and returns the string in reverse order. For example, if the input is "Hello, World!", the output should be "!dlroW ,olleH".
Find the Largest Number in an Array: Write a function that takes an array of numbers as input and returns the largest number in the array. For example, if the input is [3, 8, 2, 10, 5], the output should be 10.
Check for Palindrome: Write a function that takes a string as input and checks if it is a palindrome. A palindrome is a word or phrase that reads the same forwards and backwards. For example, if the input is "level", the output should be true.
FizzBuzz: Write a program that prints the numbers from 1 to 100. But for multiples of three, print "Fizz" instead of the number, and for the multiples of five, print "Buzz". For numbers that are multiples of both three and five, print "FizzBuzz".
Find the Missing Number: Given an array of numbers from 1 to N, where one number is missing, write a function to find the missing number. For example, if the input is [1, 2, 4, 5, 6], the output should be 3.
Remove Duplicates from an Array: Write a function that takes an array as input and returns a new array with duplicate elements removed. For example, if the input is [1, 2, 2, 3, 4, 4, 5], the output should be [1, 2, 3, 4, 5].
Check for Anagrams: Write a function that takes two strings as input and checks if they are anagrams. Anagrams are two words or phrases that use the same letters in a different order. For example, if the inputs are "listen" and "silent", the output should be true.
Find the Longest Word: Write a function that takes a sentence as input and returns the longest word in the sentence. For example, if the input is "The quick brown fox jumps over the lazy dog", the output should be "jumps".
Check for Prime Number: Write a function that takes a number as input and checks if it is a prime number. A prime number is a number that is only divisible by 1 and itself. For example, if the input is 7, the output should be true.
Count the Occurrences of a Character in a String: Write a function that takes a string and a character as input and returns the number of times the character appears in the string. For example, if the input is "hello" and the character is "l", the output should be 2.
To Find Answers To Above Questions, checkout This Github Repo: Click Here
Subscribe to my newsletter
Read articles from Mayur Patil directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Mayur Patil
Mayur Patil
Frontend Developer || UI Developer || JavaScript || React