Hi everyone! So I had couple of interviews this year for JavaScript software development roles, and I felt its worth writing an article on some of ...
For further actions, you may consider blocking this person and/or reporting abuse
One alternative to the stack example is to use shift/unshift.
A benefit is it covers adding and removing items, and allows you to treat the index of 0 as the top without worrying about it.
Also, not many people pay attention to those methods so you might even come across as clever for having non-obivous knowledge of JS Arrays.
Using shift/unshift for the stack would not be a very efficient solution when using JS arrays under the hood because that would turn an O(1) action into O(n) since every item in the array would have to update its index every time to perform either of these actions. Pushing onto the end or popping from it is O(1) since only a single item is affected.
Being able to talk about that makes a better interview.
Closure is not necessarily a function, it can be any data type.
Closure is just a reference that is in the accessible scope, whose value comes from a scope that is not accessible.
"Closure is not necessarily a function, it can be any data type" not, exactly. According to MDN: "A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment)." (source: developer.mozilla.org/en-US/docs/W...)
That is not wrong. That's just one aspect of closures.
It's wrong when you phrase it like "JUST a reference that" ("just" suggests it's only that, not "one aspect of") when it's clearly not "just a" :) That's what I meant ;)
Wrong. A closure is the combination of a function and some references to either values or variables, depending on the language.
It's commonly simplified to just a function that has access to it's calling scope, because it effectively behaves that way in javascript and pretty much any other language that has them.
They are things in computer science, sure, but perhaps not used in frontend development very much. Certainly "call stack" and "Memory Heap" referenced by the OP are things that exist, but are not really necessary to do frontend web development. Backend is a different matter...
Hi Charles!
My name is Serhii and I am from Ukraine.
I have just read your post carefully. I see you are very good at web developing.
As a beginner, I really want to learn from an excellent dev like you and make a career of mine.
If you are interest in my desire, please contact me, twentytwentyaugust@outlook.com
Thanks.
Good Job! Thank you for sharing
you explained concepts with examples, it's good.
Get Some more topics about javaScript:
tekslate.com/javascript-syntax-com...
tekslate.com/javascript-variables-...
You probably (indirectly) use Hashmaps quite often: V8 uses them to represent objects when it can't find a good way to optimize their layout.
These may not be something you implement/use in your everyday web development, but understanding them can mean you have basic understanding of code execution in JavaScript. Things like the "call stack", "Memory Heap", "callback queue" and "event loop".
Try saying Asynchronicity five times
By the way: code is uncountable when referring to source code. There is no "codes".