Javascript Mock Interview | online video interview Questions & Answers

preview_player
Показать описание
Online Technical Mock Interview of one of my viewers. Where I ask JavaScript Fundamental Questions , algorithm questions aand give their answers

#javaScript #interview #questions

*My Udemy Courses

Follow me for technology updates

Help me translate this video.
Рекомендации по теме
Комментарии
Автор

one basic solution to palindrome problem can be :

const isPalindrome = n => {
let final = 0;
let givenNumber = n;
while (givenNumber > 0) {
let remainder = givenNumber % 10;
givenNumber = parseInt(givenNumber / 10);
final = final * 10 + remainder;
}
return final === n;
};

assamaafzal
Автор

Keep zoom while candidate is writing code, its difficult to see

desolatedj
Автор

Number.prototype.isPalindrome = function(number = -1, result = []) {
if(number === -1) number = this.valueOf()
const evaluateResult = result => parseInt(result.join('')) === number
if(number <= 9) {
result.push(number)
return evaluateResult(result)
}
result.push(number % 10)
this.isPalindrome(number / 10 >> 0, result)
return evaluateResult(result)
}


const number = 101;



using a couple of techniques based on these interview videos of yours i have been watching. Many thanks learning allot!

matthewbarnden
Автор

My approach for Palindrome:


3) function numDigits(num) {
return Math.floor(Math.log10(num));
}


function palinCheck(number) {
if(Math.floor(number / 10) === 0) {
return true;
}


var num_digits = numDigits(number);


var right = Math.floor(number / Math.pow(10, num_digits));
var left = number % 10;








if(right !== left) {
return false;
}


var striped = number / 10; // strip the right
striped = Math.floor(striped % Math.pow(10, numDigits(striped)));


return palinCheck(striped);


}





bawaparampreet
Автор

Please make Angular Interview Question Series thank you techsit

MohdAfeef
Автор

I am backend developer. wanted to be fullstack developer. I see interview series to get idea and check my knowledge as well. This is really a good series for people like me. Thanks a lot sir. 🙃

saurabhchauhan
Автор

Thanks for the amazing video!


const isPalindrome = (num) => {
let numTemp = num;
let result = 0;
while (numTemp > 0) {
result = (result * 10) + Math.floor(numTemp % 10);
}
return (result === num) ? 'Palindrome' : 'Not Palindrome';
}

cvvkshcv
Автор

The correct answer to the first question is "I don't know. Let's google it and find out in 10 seconds." Like, make sure you rephrase the question back to show understanding about what is being asked, something like "I want to prevent new property definitions, but ensure the obj is still mutable" but why lose sleep over not knowing off the top of your head the exact api call.

Ianstudent
Автор

I have tried a lengthy way:
var a=12521;
var b=c=a;
var lengthOfA=0
var s=0;
for(i=0;i<c;i++){
lengthOfA+=1;
c/=10
}
for(j=0;j<=lengthOfA;j++){
s+=a%10;
a/=10
a=Math.floor(a);
if(a!=0){
s*=10
}
}
if(b===s){
console.log("a is palindrom")
}
what do you say?

viharikolla
Автор

Please make data structures and algorithms video series.

adityashinde
Автор

When I heard the questions in this interview my thoughts automatically route me to techsith videos where he would thought all these stuffs.

joemadhan
Автор

I did it this way
(you can just copy and paste in jsfiddle or similar)


function reverseInt(n) {
let pal = "";


while (n > 1) {
n /= 10;
pal += Math.floor((n - Math.floor(n)) * 10);
}

return parseInt(pal);
}


let int = 123456;
console.log(reverseInt(int));

enricomariatenca
Автор

hi sir i loved each and every video of yours :). Can you please explain about JavaScript design patterns also

nagarjunakanamarlapudi
Автор

Prabhu Shriram bless you Hemil 🙏 keep going bro

Ath
Автор

This is really helpful, please do Angular 6+ interview also

abhilashatiwari
Автор

For last one, I will find last digit by moding the given number, and store it in a variable then cut down last digit of the number by dividing with 10. Now I will generate a reverse number(initial value is zero) by multiplying reverse number with 10 and add the extracted last digit to it. I will repeat this till number is greater than zero after cutting down the last digit.. finally I will get reversed number. I will compare with actual number..this is my approch.. pls suggest is this correct approch or not..

suryaprakash
Автор

--- Here is my take ---

function isPalindrome(number) {
// number -> 121
const stack = [];
const originalNumber = number;
while (number > 0) {
stack.push(number % 10);
number = Math.floor(number / 10);
}
const reversedNum = Number(stack.join(""));
return reversedNum === originalNumber;
}

mayankchandravanshi
Автор

How about floating number palindrome, e.g. 1234.4321, which I don't think it will work in base 10, it only work for base 2 or base 2^n.

wongwanchap
Автор

Here's my solution to the palindrome question.

Number.prototype.isPalindrome = function() {
let arr = [], quotient = 0, remainder = 0, init = this;
while(init > 0) {
quotient = Math.floor(init/10);
remainder = init%10;
arr.push(remainder);
init = quotient;
}
return this === Number(arr.join(""));
}


const num = 12521;
// returns true

MuhammadIshmaell
Автор

Please, make a video about Polymorphism in JavaScrpt.

hovhannessardaryan