shadowing objects properties in javascript

When creating a property on an object that has the same property name on its prototype chain it will shadow the property on its prototype. This means that the property defined on the object will always be found first instead of looking through the prototype for the property.

JavaScript

let myName = {
  name: 'Brian'
}

// make the 'myName' object be in the prototype of 'yourName'
let yourName = Object.create(myName);
yourName.name; // Brian

yourName.name = 'Daniel';
yourName.name; // Daniel

yourName.__proto__; // {name: "Brian"}

When creating the new property ‘name’ on the yourName object it shadows the ‘name’ property on the prototype.

react
dynamic image source create-react-app

how to load images with different sources / url with create react app

javascript
function declarations in JavaScript

In JavaScript functions can be declared with function statements, anonymous functions and arrow functions.