JSFiddle - React, Tailwind, and code Playground
by tuanderful
JavaScript
/* Digesting JavaScript: The Good Parts
Arguments
*/
function foo( argObject ){
var x = argObject.x,
y = argObject.y,
title = argObject.title,
sum = argObject.x + argObject.y;
document.write(argObject.title + ": ");
document.write(sum);
}
document.write("Test 1<br />");
foo({title:"bar",
x: 3,
y: 5}); // bar: 8
document.write("<br /><br />Test 2<br />");
foo({x: 3,
y: 5}); // 3: NaN
document.write("<br /><br />Test 3<br />");
foo({title: null,
x: 3,
y: 5}); // null: 8