Graduating pretty soon and have a few coding interviews coming up. Show I definitely feel most comfortable with JS as it's the language that I've spent the most time on, but not sure if this is the best language to use for coding interviews. I do have some experience with Java and Python but am just not as proficient at them as in JS. Since I have a few months, I'm very willing to dive into any other languages if necessary. Can you guys share your personal experiences or thoughts with coding interviews / OAs with JS? Hello and welcome back to Code Review, a series of coding interview challenges and career related content released weekly exclusively on Dev.to. I’m Elisabeth and I’ve been a software engineer for about 4+ years now. I’m passionate about sharing my knowledge, and best tips and tricks when it comes to acing that interview and or just leveling up your coding skills. If you want more content and challenges like these, subscribe to the Coderbyte newsletter here. That’s it for stand up - let’s get to challenge solving! The ChallengeWrite a class,
For example:
The solution:This is a great opportunity to use ES6 classes. In case you haven’t used them before, check out their syntax here. We can start with a basic structure for the class
OnNext we can start working on our methods. First up is
Because functions are first class objects in javascript, which basically means they can be stored in a variable, an object, or an array, we can just push the callback function to an array
stored at the key EmitNow, for our
This solution takes advantage of what is called closure in javascript. If you are coding in Javascript in your interview, understanding closure can be vital. A closure is essentially when a function has references to its surrounding state or its lexical environment. You can also think of this as a closure allowing you access to an outer function’s scope from inside an inner function. Using global variables is a great simple example of closure. Here’s another great example of using closure to track how many times a function was called.
The inner function returned in RemoveListenerThe
And that’s the class! Pun intended :) Seeing if you can implement methods that are part of the language is a great way to practice for interviews. See you all next week! Is it OK to use JavaScript for coding interview?The answer is yes. Most companies let you code in any language you want - the only exception I know being Google, where they only allow candidates to pick from Java, C++, JavaScript or Python for their algorithmic coding interviews.
Can I use JavaScript in interview questions?JavaScript Interview Questions for Freshers. What are the different data types present in javascript? ... . Explain Hoisting in javascript. ... . Why do we use the word “debugger” in javascript? ... . Difference between “ == “ and “ === “ operators. ... . Difference between var and let keyword in javascript.. Which language is best for Google interview?For Google software engineering interview you can prefer any programming language you are comfortable with but you should know your programming language very well, It would be great if the choice is C++ or Java.
What does Google use for coding interviews?Google prefers the following programming languages: Java, C++, C Go, and Python. There are three types of coding problems you can expect to see in a Google interview. System design questions: these questions gauge your ability to handle high-level system design with scalability in mind.
|