10 JavaScript Interview Questions

const a;
console.log(a); // undefined
const b = null;
console.log(b) // null
const scopeExample = () => {
const a = 5;
console.log(a) // 5
}
console.log(a) // It will throw an error.
const a = 10;const scopeExample = () => {
const a = 5;
console.log(a) // 5
}
console.log(a) // 10
console.log(5 == '5'); // true
console.log(5 === '5'); // false
function recursion(x) {
if(x < 10) {
return x;
}
else {
return x * recursion(x-1)
}
}
const a = recursion(15);
console.log(a) // 32432400
const firstObject = {
name: 'Roky Das',
firstFunction: function() {
console.log('Hi I am from function');
}
}
const secondObject = {
name: 'Mintu Das'
}
const secondFunction = firstObject.firstFunction.bind(secondObject);
secondFunction(); // Hi I am from function
var myName= "Roky Das";const showName = () => {
console.log(myName); // 'Roky Das'
}
function outer() {
var name = 'Roky Das';
function showName() {
console.log(name);
}
showName();
}
outer();
const a = 20 * "3";
console.log(a) // 60
[34, 56, 87].toString() // "34,56,87"

--

--

--

I am an enthusiastic JavaScript developer with knowing some framework for the frontend and the backend.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Does your JavaScript Arrow Function Use {}? Use an Explicit Return!

allDogs array of dogs is defined along with a returnGoodDogs function that should return only dogs whose attribute of “good” has a value of true, but the arrow function lacks an explicit return in this case and will return undefined.

CC_Midterms

MutationObserver API — Additional Params

The dev.to project with GatsbyJS-29

React Native payment using Stripe

Moving API requests to Redux-Saga

Leetcode 1869. Longer Contiguous Segments of Ones than Zeros

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
Roky Das

Roky Das

I am an enthusiastic JavaScript developer with knowing some framework for the frontend and the backend.

More from Medium

CleverTap Javas Hackathon Experience

JavaScript, I’ll callback later

JS| How to use Promise.all to handle thousands of request

How Javascript Runs In The Browser - Part 1