I have recently switched to a new role where Javascript (nodejs) is the primary language/stack. I have always worked with java at my previous jobs as well as in school. I like javascript but I am wondering how does Javascript compare to Java when writing solution for general interview questions. Javascript (es6) as a language lacks most commonly used data structure which comes bundled with Java collections package (stack, queue, trees, priority queue, tree map rtc) which imo are essential to approach a medium or hard level problem. I don't think we would have enough time in an interview to implement priority queue first and then use it as a data structure to solve the problem. How have folks approached this problem in Javascript? As a side note, using Java is not an option for me as it doesn't reflect well to use Java while applying for a nodejs or full stack position.
A brief bit of help with that is to think about how you use priority queue in your coding style and then practice a bit of breaking down that process. Since you are going for the node side of things you can break down the use of a priority queue into functional components and build that into your solution. Essentially you will have the most basic version of the thing you want but implemented in a different way. You can also use that deep knowledge you have to bring up the fact that you are using different data structure to solve the problem and why. Itâs all in the messaging. Use your knowledge to your advantage wherever you can.
I donât think Javascript is the best choice due to a lack of data structures like arrays and it may be more difficult to estimate time-space complexity. In one Google interview I was given a Java concurrency problem. In another, a Javascript front-end problem. Other interviews were standard leetcode type. Java+Javascript will work fine for full stack interviews.
But Javascript does have Arrays. It just considered as an object under the hood.
When doing Google onsite I used JavaScript because it was familiar and easy syntax. 2 of my interviewers asked me non-LC style questions related to JS syntax and frontend stuff. I wasnât expecting this and it threw me off since I had solely prepared for DS/algo questions. I was applying for General SWE, not frontend. Point being: know that your interviewer may make assumptions about you based on choice of language, and tailor the interview to that.
Had exactly the same experience