Solving LinkedIn Frontend Interview Question | Tuple | Arrays of Array | JavaScript

  Рет қаралды 2,241

Devtools Tech

Devtools Tech

Күн бұрын

Пікірлер: 15
@JigyasaUpadhyay-l9s
@JigyasaUpadhyay-l9s 4 ай бұрын
great explanation, keep up the consistency !
@DevtoolsTech
@DevtoolsTech 4 ай бұрын
Thanks! ♥️
@DhruvDhar-r3l
@DhruvDhar-r3l Ай бұрын
i was under the impression that `multiply()` had to be added on the prototype of `tuple()`'s result only..... function multiply(position) { let res = this[0][position-1] for(let i=1; i
@sujalgupta6100
@sujalgupta6100 4 ай бұрын
Hi Yomesh, is there any video of yours for guiding for prep for interview like from JS Topics to cover + What concepts/kind of questions one must prepare as there are so many of them. Some folks keep posting huge list of JS concepts + Output based questions + Polyfill based questions + Any component implementation like Chip or OTP form etc. What to prepare form all of them ? Or maybe how much, it feels way too much.
@DevtoolsTech
@DevtoolsTech 4 ай бұрын
Hey, I don't have curated list. This is too big so any list will become big eventually. I will try to create something already it ajd share soon!
@DhruvDhar-r3l
@DhruvDhar-r3l Ай бұрын
i was under the impression that multiply had to be added to the prototype of the returned array only and not on the entire Array.prototype function tuple(input) { const outputArr = [] let stack = [] for(const ch of input) { if(ch === '(' || ch === ',' || ch === ' ') continue else if(ch === ')') { outputArr.push(stack) stack = [] } else { stack.push(+ch) } } //ADD multiply to the prototype of the returned array outputArr.multiply = multiply return outputArr }
@DevtoolsTech
@DevtoolsTech Ай бұрын
It works both ways. You can add it to tuple too. There are edge cases that you need to take if you add it to tuple.
@sourabhrajwade1061
@sourabhrajwade1061 3 ай бұрын
Nice explanation. I did it by using transversing the tuple array. I have one question though. Why you added multiple in Array prototype ? Shouldn't it be tuple's property?
@DevtoolsTech
@DevtoolsTech 3 ай бұрын
Depends upon the interviewer what they want to test. Both works. I added on tuple because of convenience as we dont need to take care of a lot of edge cases in thatcase.
@AnkitGupta-lr1qq
@AnkitGupta-lr1qq 4 ай бұрын
Great explanation. Wondering if it'd be better to throw OR return something like NaN instead of 0 inside the multiple method when the array length is 0. 0 might be a valid return value as well and doesn't distinguish enough from an edge case (like the empty array)
@DevtoolsTech
@DevtoolsTech 4 ай бұрын
Valid point. This is also a discussion point with interview about what is the expected behaviour. I agree that 0 is a valid output. However, we need to make a decision that should we break the application by throwing an error or return 0 that shows like a default output as for user if the application breaks then that is a really bad experience.
@virendrapratap2417
@virendrapratap2417 2 ай бұрын
Correct me if i am wrong. line no 22: can be replaced with current.hasOwnProperty(position) instead of borrowing has own property using call?
@DevtoolsTech
@DevtoolsTech 2 ай бұрын
Yes, it can be used. However, it id advised not to. Check the following please eslint.org/docs/latest/rules/no-prototype-builtins
@jithendra16
@jithendra16 4 ай бұрын
Can you please make a video on how to write regex expressions Also any explanation on why did you use prototype to find whether that index is present? It will be helpful
@DevtoolsTech
@DevtoolsTech 4 ай бұрын
Thanks for the suggestions! I will include it in future videos!
How to build a Loading Animation using CSS and React.js?
7:08
Devtools Tech
Рет қаралды 2,2 М.
Solving Output Based JavaScript Interview Questions
28:17
Devtools Tech
Рет қаралды 3,5 М.
Man Mocks Wife's Exercise Routine, Faces Embarrassment at Work #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 4,7 МЛН
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 20 МЛН
Frontend Interview Question For Practice | JavaScript Problem Solving
26:46
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 78 М.
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
Stop Using FirstOrDefault in .NET! | Code Cop #021
12:54
Nick Chapsas
Рет қаралды 71 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,7 МЛН
All 33 JavaScript Array Methods In One Video
51:11
Code Explained
Рет қаралды 31 М.
The Most Important Skill You Never Learned
34:56
Web Dev Simplified
Рет қаралды 206 М.
JavaScript Array Mastery: Tips, Tricks & Best Practices
1:02:49
Envato Tuts+
Рет қаралды 23 М.
Man Mocks Wife's Exercise Routine, Faces Embarrassment at Work #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 4,7 МЛН