JSFiddle - React, Tailwind, and code Playground

by chrisramakers

JavaScript

// Passing by value
var doors = 3;
function addDoor(v) {
    v += 1;
}

addDoor(doors);
//document.write(doors, '<br>');

// Passing by reference
var car = { doors : 3 };
function doSomething(v) {
    v.doors += 1;
}

doSomething(car);
//document.write(car.doors);