Major JavaScript Data Structures
I have a job interview coming up, and one of the core technologies of the company is JavaScript. I was told that the next interview will focus on JS Data Structures, a term that never came up in any of my education. I have spend a while on Google trying to find out more about them, and the best thing I could come across was this Wikipedia page.
As you can tell, the list of items is quite long and way too much to study before my interview. Since the Wiki article is generic and not JS specific, I know that some (most?) of what's on there does not apply to JS. C开发者_如何学Can I get some help on what are the main data structures and what I should focus my time on? I was unable to find an answer to that on Google.
I know Arrays are one of the major ones that I will need to know. What are the other major data structures I should be prepared to talk about?
Thanks for any help!!!
Javascript itself doesn't have a lot of built-in data structures to speak of, actually.
If I were in your shoes, I'd give myself a run-down of data structures in general, which apply to programming in general instead of any specific language.
If you're not feeling confident about JS in particular, one resource I'd recommend would be the Mozilla Developer Network, and in particular this guide which should cover a lot of ground, including the core object types (Array, String, Date, etc). You can always give a look to w3schools, but I don't really recommend it much anymore as it has a number of inaccuracies.
Good luck on your interview!
EDIT: You could probably even try to implement certain data structures in JS to get to grips with how you would go about it. Knowing how a red-black tree works is really great and all, but knowing how to implement it nicely in a given language is definitely a plus! ;)
Strange as it may sound, a Javascript object is a data structure. I'd even say it is the major data structure in Javascript. It is a container that provides encapsulation for both other types of data as well as functions. Objects also act as associative arrays.
Function is first-class in Javascript, meaning you can pass it around as a parameter or a return value. That in my opinion makes it a kind of a data structure as well.
Understand this question is old - 9yrs, things have changed a lot around Javascript with the vision of javascript everywhere - front-end(react, next, vue ...), back-end(node.js) and everywhere (electron, pouchdb, nedb, ...) in between. For those landing on this question, here are some more options apart the from above links for Modern Javascript Tutorial data structures
Mnemonist Nice collection of well documented and maintained common data structures
Standard Data structures
Others:
Eloquent Javascript
Google Javascript Style Guide
AirBNB Javascript Style Guide
Data structures are language agnostic, so - keep practicing and Good luck with the interviews.
精彩评论