JSFiddle - React, Tailwind, and code Playground

by chrisramakers

JavaScript

// Modify the property of an Object and primitive
var a = 3;
var b = new Number(3);

function multiply(v){
    v.double = v * 2;
}

// on a primitive
//document.write('a.double before: ', a.double, '<br>');
multiply(a);
//document.write('a.double after: ', a.double, '<br>');

// on an object
//document.write('b.double before: ', b.double, '<br>');
multiply(b);
//document.write('b.double after: ', b.double, '<br>');