Commonly Asked Coding Interview Questions JavaScript
coding interview questions javascript, javascript interview questions for experienced, javascript interview questions, javascript interview questions jsmount, top javascript interview questions, advanced javascript interview questions
💡Write a program to Check the number is Palindrome.
function checkPalindrome(str) { if(str) { var pattern = /[^a-zA-z]+/g; // first remove spaces and special chars from given string str = str.replace(pattern, '').toLowerCase(); var str1 = str.split('').reverse().join(''); console.log(str, str1); // for testing if(str1 == str.toLowerCase()) { return true; }else { return false; } } }
Output >
checkPalindrone(“diD”)
=> true
> Second way without using any predefined method:
function checkPalin(str) { var pattern = /[^a-zA-z]+/g; var output = ""; var input = str.replace(pattern, '').toLowerCase(); for(var item of input) { output = item + output; } if(input == output) { return true; }else { return false; } }
Output >
checkPalin(“Cigar? Toss it in a can. It is so tragic”)
result is true
💡Write a program to count duplicate characters in a string
function duplicateCharCount(str) { if(str) { var obj = {}; for(let i = 0; i < str.length; i++) { if(obj[str[i]]){ obj[str[i]] += obj[str[i]]; }else { obj[str[i]] = 1; } } console.log(obj); } }
Run this Code >
duplicateCharCount(“aabcdd”);
Output > {a: 2, b: 1, c: 1, d: 2}
💡Write a program to check whether two objects are the same or not.
function equal(obj1, obj2) { let keys = Object.keys(obj1); // first find keys of first Object let output = false; for (let i = 0 ; i < keys.length ; i++) { output = (obj2.hasOwnProperty(keys[i]) && obj1[keys[i]] == obj2[keys[i]]) ? true : false; } return output; }
var o1 = {b : 1, c : 2};
var o2 = {b: 1, c : 2};
equal(o1, o2); –> true
var o1 = {b : 1, c : 2};
var o2 = {b: 1, c : 2 , d: 4};
equal(o1, o2); –> false
coding interview questions javascript, javascript interview questions for experienced, javascript interview questions, javascript interview questions jsmount, top javascript interview questions, advanced javascript interview questions
- JavaScript Coding Interview Question & Answers
- React Interview Question & Answers – Mastering React
- Top React Interview Question & Answer | React Routing
- Top React Interview Questions and Answers | Must Know
- Interview Question React | Basics for Freshers and Seniors
- Cyber Security Fundamental Questions & Answers You must know
- Application & Web Security Interview Questions & Answers
- Angular Interview Questions & Answers 2021 – Part 3 – JS Mount
- Angular Interview Questions & Answers You should know Part 2
- Top 30 JavaScript Interview Questions and Answers for 2021
- NgRx Top Interview Questions and Answers You should know
- Top 40 Awesome CSS Interview Questions & Answers You should know | CSS Tutorial
- Top JavaScript Commonly asked Algorithms in Interview
- Angular NgModule, AOT, and DI, and EntryComponents with example
- TypeScript New & Latest Features You should know | JS Mount
- Rx JS Top Operators with examples | Rx JS interview questions
- What’s new in Angular 9 | Top updates in Angular 9 By JS mount
- What’s new in Angular 8 | Angular 8 Latest Feature By JS mount
- JavaScript Top Interview questions & Answers You should know
- Top 30 TypeScript Interview Questions & Answers You Must Know
- HR Interview Questions and Answers for Experienced
- Mastering JavaScript Interview Questions & Answers
- Commonly Asked Coding Interview Questions JavaScript
- Angular Interview Question & Answers for Experienced – Part 1
- Most Asked JavaScript Interview Questions for Experienced
- Frequently Asked HTML Interview Questions and Answers
- HTML Interview Questions and Answers on Canvas
- JavaScript Console Interview Questions | Input Output Program
- JavaScript Hoisting Interview Questions | Coding Exercise
- JavaScript ++ Operator | X++ and X = X++ Explanation
sbobet
Hello to everybody, it’s my first go-to see of this weblog; this blog consists of awesome and genuinely fine data in favor of readers.
ปั้มไลค์
Like!! Thank you for publishing this awesome article.
Riley Cardani
tÒºe website Ñ–Ñ• really good, I really like your site!