Cracking JavaScript coding Interview by learning difficult JavaScript interview Questions. commonly Asked JavaScript Interview Questions.
Please be my patreons on patreaon
* https://www.patreon.com/techsith
Follow me for technology updates
* https://facebook.com/techsith
* https://twitter.com/techsith1
Help me translate this video.
* http://www.youtube.com/timedtext_video?ref=share&v=3qnrouysbG8
Note: use https://translate.google.com/ to translate this video to your language. Let me know once you do that so i can give you credit. Thank you in advance.
Original source
37 responses to “Top Tricky JavaScript Interview Questions and Answers”
Inside NaN they are different like
57sgt674fyj&6&(6_: === gi3754_76ticc58&
That's why they always gives false even with itself
var arr = [2,3,42,4,5,4,5,6,7,2,3]
, if we have an array like this
we cannot get expected results with '<' or '>' operator
it's a bit unfair and stupid asking such granular details almost no one uses on job interview, unless you are interviewing a senior developer.
2:31 index doesn’t mean to find the value. Its like find me the location of that value.
In the video 12.17, if b is a global variable. Why it didn't print at first time. Please reply back
If a programmer asks this "trick question" in an interview, I get up and leave.
All to the fact that NO ONE will dare write this type of shit and commit this code, it's unreadable, unrelated and confusing, if you would like to return (-1) from your array, there are a myriad of SIMPLE AND READABLE ways to do it.
The only thing I could think he's trying to gain out of this is him trying to show me that he knows how to be a good QA, nothing more.
After reading javascript
Aby kya hai ye isne to programming k fundamentals ko hi palat diya
8:44 – wrong. MAX_VALUE multiplies to Infinity, not 0
Excelent video! The only thing is that the one with the iife, if you console log a in the chrome console it gives you [-1: -1] instead of the error you show!….and b it gives 100 indeed…did something changed in the language? Try it in the new chrome!
05:25
I don't seem to get it to work by using return a > b.
Weird thing is that if I return a – b then it works properly. Am I doing something wrong?
Thank you in advance.
const arr = [1, 2, 15, 30, 5, 45, 7];
console.log(arr.sort((a, b) => {
return a – b;
}));
I couldnt find the tutorial on negative indexes. Could someone please point me to it?
I loved it, Can i have quations like this of angularJS 1.x as well?
very nice…
The one you mentioned for sorting is not working. Instead of returning a<b or a>b it should be a-b or b-a in the call back function. Thank you for this video 🙂
Thanks, techsith.
I tweeted this video! Ty
As a primarily c++ programmer, I am thoroughly confused 🙂
11:53 how did the '6' come in?
null===null give you true,NaN==NaN give false
For the sorting one, the comparison is not working because the function looks for a number value, not a boolean 🙁
x.sort((a,b) => (a-b)) works though!
Thanks for this though and I love your videos
Thank you so much for making the videos and helping the web developers careers.
For some reason, the sorting of integers with callback didn't work with a<b, b<a, instead works with a-b, b-a.
console.log(arr.sort((a,b) =>
{
return b-a;
}));
I like that interview series. thanks!
sir , i have one question. Actually i was asked this question in interview. the question is about converting normal javascrpt function to call back function… so question goes like this,…
function aa(){
return 1;
}
var res = aa();
so they wanted me to convert above function into call back function.. how to do sir ? plz help
i love your accent it's very clear!
That Number.MIN_VALUE question got me! That really did stump me! Thank you for showing us these difficult problems!
But in the sort example when the array is longer than 10 elements doesnt work it.
prefer pass in the call back return a-b
it would be FALSE
👍 cool experiments with js. thank you sir.
I really enjoy these series. Thanks you sir!
cont x=[1,2,3];
x.indexOf[10000] will be -1 as you said but when I tried doing that it's getting undefined.
=== compares value and data type right (value same)(type of nan is number so data type also same)value same data type same it will returns true right
Hi,
Could you tell me Y this result is coming in my console?
var i = Number.MIN_VALUE;
console.log(i);
console.log(i+i);
console.log(i-i);
console.log(i*i);
console.log(i/i);
VM173:2 5e-324
VM173:3 1e-323
VM173:4 0
VM173:5 0
VM173:6 1
video is great but HR would not ask so many tricky and meaningless question for one student. Such question based on concepts but far away from the real world
Javascript is awesome!
I feel like I'm applying to be a Mathematician and not a Developer lol
11:05 – the weirdest part is if you console.log 17 fives it will return 55555555555555550.
Shouldn't it have "..60" on the right?
And console.log(44444444444444444); gives us this: 44444444444444450.
Doesn't make any sense =)
NaN compared to anything is always false.However, Here comes the interesting stuff (typeof null is an Object and type of Object is also Object. When you do a "==" with both of them, it will return you a false.