Copying objects with Shallow copy Now that we went over shallow and deep copies in part 1, let’s go over shallow copying in JavaScript. There are 3 ways to create shallow copies in JavaScript: Iteration using for key in an object Spread operator Object.assign() 1. Iteration using for key in an object In order to copy the items of an object into another object we
Deep and shallow copying in JavaScript – part 1
Copying objects with shallow and deep copies Primitive values such as strings, and numbers are copied by value, whereas objects are copied by reference. What do we mean by this? The following code example will explain this practically: let num1 = 10; let num2 = num1; num1 = 6; console.log(num2); //10 The value of num1 which is the number 10 is assigned to the variable
Pass by reference vs Pass by Value
Pass by value Non-primitive data types are passed by reference compared to primitive data types that are passed by value. As such non-primitive data types are also called reference types. To understand why they’re called reference types, we need to briefly look at how variables are stored in memory. A fixed amount of memory is allocated to a variable after it is declared. For primitive
Execution context in JavaScript for beginners
Introduction Execution context is an abstract concept describing the environment within which JavaScript code is executed. The execution context will dictate if a variable, object, or another block of code is accessible or not. There are two types of execution contexts: global and function. Let’s examine the global execution context first. Global execution context The global execution context is the default execution context. Variables and
What is the event loop anyways?
Introduction JavaScript is single-threaded this means that the main thread on which code is executed runs one line at a time. There is no possibility of doing anything in parallel. Therefore, the run time is blocked until a task is completed. An example of blocking the run time is an infinite loop. However, the DOM API, setTimeout() , setInterval() methods are provided by the web
Understanding the call stack
What is the call stack? An understanding of the call stack will allow you to understand how execution order in JavaScript works. JavaScript is a single-threaded language; this means that it handles one task at a time. JavaScript code is executed by the JavaScript engine. Google’s V8 engine is an example of a popular JavaScript engine, there are others such as the SpiderMonkey and Rhino.
Why I wrote The JavaScript Technical Interview Guide
Pre-Launch It’s been a busy 2 days, I pre-launched the JavaScript Technical Interview Guide and have sold 50% of the early bird copies. I made an announcement on Twitter and on Reddit. So far 280 upvotes on Reddit! Anyways keep reading – the juice is down below! So far I’ve emailed subscribers once with 80 practice coding exercises from chapter 1 (The Basics) . Besides
JavaScript technical interview workbook
Introduction Hi devs especially junior devs! For the past 5 months I’ve been super focused on writing a technical interview guide for juniors who want to break into the web-development industry. Since a solid grounding in JavaScript is paramount to clearing interviews focused on web applications, I wanted to write a guide that would help junior developers learn and practice at the same time. Why?
💟Astrid learns JavaScript
This past month I’ve been working with an animation studio in Utah to help create a course on JavaScript for kid! It’s been a lot of fun! See the trailer here! https://vimeo.com/storyboxentertainment/review/408998377/d003cca7d9 https://vimeo.com/storyboxentertainment/review/408998377/d003cca7d9
Ml5.js #machinelearning library for newbies
Introduction I’m glad there are machine learning implementations in JavaScript. Abstracts a lot of the complexities associated with training & using machine learning models. I just hope ml5.js doesn’t become obsolete tomorrow or the next month! Python has been the modern de-facto language for #machinelearning. And there are tons of python libraries to implement machine learning tasks. However, JavaScript implementations of machine learning are fairly