Sunday, December 16, 2018

JavaScript Mutable and Immutable Objects

In JavaScript Primitives are immutable, which means that the value is passed instead of reference.
For Objects the reference is passed instead of value. Example as below,

//Primitives are immutable
var a = 10;
var b = a;

console.log("a: "+a);
console.log("b: "+b);

a =20;

console.log("a: "+a);
console.log("b: "+b);

var c = {name: "Zack"};

var d = c;
console.log("c: ";
console.log("d: "; = "Arnold";
console.log("c: ";
console.log("d: ";

Ensure whether you are passing value or reference during development. This is one of the basic concepts in JavaScript. 

JavaScript Objects Types

In JavaScript there are 3 ways you can create an Object. Examples as below,

var object1 =
    name: "Zack",
    age: 35

console.log("Object 1 Name: ";

var object2 = new Object(); = "Zack";
object2.age = 35;

console.log("Object 2 Name: ";

function Object3(name, age)
{ = name;
    this.age = age;
    this.getName =function () {
var object3 = new Object3("Zack", 35)
console.log("Object 3 Name: "+object3.getName()); = "male"; = "male"; = "male";// Value will be undefined for the Object
// = "male";

console.log("Object 1: "+;
console.log("Object 2: "+;
console.log("Object 3: "+;

The 3rd Type of Object is the most used type, since it is highly reusable. 

Tuesday, October 2, 2018

When installing Atom Packages some machine will receive a error as

failed: unable to get local issuer certificate (UNABLE_TO_GET_ISSUER_CERT_LOCALLY)

PS C:\Code\NodeJS Exercise> apm install split-diff
Installing split-diff to C:\Users\zack.dawood\.atom\packages failedRequest for package information failed: unable to get local issuer certificate (UNABLE_TO_GET_ISSUER_CERT_LOCALLY)

In order to fix this execute the following command

apm config set strict-ssl false

Now install the required package, it should work

apm install split-diff