Top 15 Javascript Interview Questions!

  • Number
  • String
  • Boolean
  • Object
  • Undefined
function isPrime(num) {
for(var i = 2; i < num; i++)
if(num % i === 0) return false;
return num > 1;
}
function reverseString(str) {

// empty string
let newString = "";
for (let i = str.length - 1; i >= 0; i--) {
newString += str[i];
}
return newString;
}

// take input from the user
const string = prompt('Enter a string: ');

const result = reverseString(string);
console.log(result);
var names = ["Nadim","Mahmud","Nil","Md","Jalil","Khan","Ummay"];
var uniqueNames = [];
$.each(names, function(i, el){
if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
  • Variable used in the code doesn’t exist
  • Variable is not assigned to any value
  • Property does not exist.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nadim Mahmud

Nadim Mahmud

4 Followers

My name is Nadim Mahmud. I am a software developer with extensive knowledge in programming, web development, mobile development, and database design.