The tech English for FrontEnd
Recently, I have been diving into technical interview in English for 2 months, so I would like to record these questions for two reasons, first, it helps me reviewing these questions easier, and the other is that may help someone else. Anyway, let’s jump right in with happiness.
- What are the advantages of Javascript being single threaded?
JavaScript being single-threaded is one of its core characteristics, and there are several benefits here:
. Simplified Execution, JavaScript run tasks one at a time, reducing complexity a lot, developer doesn’t need to manage to race conditions or synchronization issues are often occurring in multi-threaded language.
. No context switching, in multi-threaded language, it’s common that the overhead happened when we are using multiple threads, so JavaScript avoids this, and improve efficiency.
. Event-loop and Asynchronous programming, Javascript use an event-driven, non-blocking model through the event-loop mechanism, that allows Javascript handle the asynchronous task without freezing the main thread.
.Simplify debugging, in the single thread, it’s always easier to debug code compare with the multi-threaded language.
Plus, JavaScript still remains the ability to handle concurrency through the Web Worker and Async / Await /Promise. Those things make JavaScript easier and more efficient to develop. - What does the interpreted characteristic mean for JavaScript?
Being interpreted means that Javascript code is not pre-compiled into machine-language, some languages like Java or C++, which would be compiled into machine language ahead of time. Instead of that, JavaScript is read and executed directly by the interpreter like V8 engine. It has a lot of benefits like easy debugging, quick execution, especially in web development environments, where changes can be tested in real time. But it can’t always be as fast as the compiled language, although modern optimizations of compilation has greatly improved.
Important terms
- single(multi)-threaded:单(多)线程
- core characteristics:核心特点
- Simplified Execution:简化执行
- event-driven: 事件驱动
- race conditions:竞速情况
- non-blocking model:非阻塞模型
- event-loop mechanism:事件循环机制
- concurrency: 并行
- pre-compiled:预编译
- machine-language: 机器码