Edison  Stark

Edison Stark


Shallow Copy and Deep Copy | Advanced JavaScript Tutorial

Learn the difference between a Shallow Copy and a Deep Copy in this Advanced Javascript Tutorial. We cover shallow copy vs deep copy, mutable vs immutable and passing values vs references. Pure functions need you to know this foundational knowledge.

Shallow Copy and Deep Copy | Advanced Javascript Tutorial

  • (00:00) Intro
  • (0:24) Javascript data types review
  • (1:03) passing values vs passing references
  • (3:05) mutable vs immutable data
  • (5:52) an impure function
  • (8:20) how to make a shallow copy
  • (14:17) how to shallow freeze an object
  • (16:04) how to make a deep copy
  • (21:43) a pure function
  • (23:45) Review of concepts


What is GEEK

Buddha Community

Shallow Copy and Deep Copy | Advanced JavaScript Tutorial

JavaScript: Shallow vs Deep Copy

Copying values seems somewhat trivial. Nevertheless, it’s almost impossible to find a developer that has never had an issue with some wrong reference, or pointer in the case of C-like languages. In this article, I’m going to focus on how to copy variables/values in JavaScript.

JavaScript: Shallow vs Deep Copy

Primitive vs Reference Values

Primitive values

In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods. They are the following:

  • String
  • Number
  • BigInt
  • Boolean
  • undefined
  • Symbol
  • null (which indeed is a special case for every Object)

Primitive values are immutable — instead of changing them directly, we’re modifying a copy, without affecting the original. **They are passed by value. **They’re assigned to variables and passed into functions by copying their value.

let example = '0';
let example_copy = example;

example = '1';
console.log('example');      // '1'
console.log('example_copy'); // '0'

Reference Values

Reference values, objects, and arrays, which are a special type of an object, are a bit different. Contrary to primitives these are mutable. This means they have properties that we can access and change

**They are passed by reference and no copies are made before passing them. **This article is focused on these and different ways of copying them.

Shallow Copy

Shallow copy means we just pass just the reference meaning only the memory addresses are copied.

Let’s create a basket object indicating we have 1 keyboard and 2 monitors as default values and trying to copy it.

let basket = { keyboard: 1, monitor: 2 };
let basketShallow = basket;

basket.keyboard = 3;
console.log(basket);        // { keyboard: 3, monitor: 2 }
console.log(basketShallow); // { keyboard: 3, monitor: 2 }

Notice that the basket_shallow.keyboard value has changed. This happened because the value was copied by the reference and changing in one place will change for all variables sharing that object reference.

#javascript #coding #programming #deep-copy #shallow-copy

Terry  Tremblay

Terry Tremblay


Now Learn JavaScript Programming Language With Microsoft

icrosoft has released a new series of video tutorials on YouTube for novice programmers to get a hands-on renowned programming language — JavaScript.

This isn’t the first attempt by Microsoft to come up with video tutorials by beginner programmers. The company also has a series of YouTube tutorials on Python for beginners.

For JavaScript, Microsoft has launched a series of 51 videos as ‘Beginner’s Series to JavaScript,’ for young programmers, developers and coders who are interested in building browser applications using JavaScript. These video tutorials will also help programmers and coders to use relevant software development kits (SDKs) and JavaScript frameworks, such as Google’s Angular.

“Learning a new framework or development environment is made even more difficult when you don’t know the programming language,” stated on the Microsoft Developer channel on YouTube. “Fortunately, we’re here to help! We’ve created this series of videos to focus on the core concepts of JavaScript.”

It further stated — while the tutorials don’t cover every aspect of JavaScript, it indeed will help in building a foundation from which one can continue to grow. By the end of this series, Microsoft claims that the novice programmers will be able to work through tutorials, quick starts, books, and other resources, continuing to grow on their own.

#news #javascript #javascript tutorial #javascript tutorials #microsoft tutorials on javascript

wp codevo

wp codevo


JavaScript Shopping Cart - Javascript Project for Beginners


#shopping cart javascript #hopping cart with javascript #javascript shopping cart tutorial for beginners #javascript cart project #javascript tutorial #shopping cart

Lowa Alice

Lowa Alice


JavaScript Tutorial for Beginners: Learn JavaScript in 1 Hour

Watch this JavaScript tutorial for beginners to learn JavaScript basics in one hour.
avaScript is one of the most popular programming languages in 2019. A lot of people are learning JavaScript to become front-end and/or back-end developers.

I’ve designed this JavaScript tutorial for beginners to learn JavaScript from scratch. We’ll start off by answering the frequently asked questions by beginners about JavaScript and shortly after we’ll set up our development environment and start coding.

Whether you’re a beginner and want to learn to code, or you know any programming language and just want to learn JavaScript for web development, this tutorial helps you learn JavaScript fast.

You don’t need any prior experience with JavaScript or any other programming languages. Just watch this JavaScript tutorial to the end and you’ll be writing JavaScript code in no time.

If you want to become a front-end developer, you have to learn JavaScript. It is the programming language that every front-end developer must know.

You can also use JavaScript on the back-end using Node. Node is a run-time environment for executing JavaScript code outside of a browser. With Node and Express (a popular JavaScript framework), you can build back-end of web and mobile applications.

If you’re looking for a crash course that helps you get started with JavaScript quickly, this course is for you.


00:00 What is JavaScript
04:41 Setting Up the Development Environment
07:52 JavaScript in Browsers
11:41 Separation of Concerns
13:47 JavaScript in Node
16:11 Variables
21:49 Constants
23:35 Primitive Types
26:47 Dynamic Typing
30:06 Objects
35:22 Arrays
39:41 Functions
44:22 Types of Functions

📺 The video in this post was made by Programming with Mosh
The origin of the article: https://www.youtube.com/watch?v=W6NZfCO5SIk&list=PLTjRvDozrdlxEIuOBZkMAK5uiqp8rHUax&index=2
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#javascript #javascript tutorial #javascript tutorial for beginners #beginners

CSS Boss

CSS Boss


How to create a calculator using javascript - Pure JS tutorials |Web Tutorials

In this video I will tell you How to create a calculator using javascript very easily.

#how to build a simple calculator in javascript #how to create simple calculator using javascript #javascript calculator tutorial #javascript birthday calculator #calculator using javascript and html