You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
366 B
JavaScript
25 lines
366 B
JavaScript
function doTheThing(item = 42) {
|
|
item.stuff.makeNoise("hello");
|
|
}
|
|
|
|
function makeTheThing(noisy) {
|
|
let empty;
|
|
let obj = {
|
|
exist: true
|
|
};
|
|
|
|
if (noisy) {
|
|
obj.makeNoise = function makeNoise(noise) {
|
|
console.log(noise);
|
|
}
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
let thingOne = makeTheThing(true);
|
|
let thingTwo = makeTheThing(false);
|
|
|
|
doTheThing(thingOne);
|
|
doTheThing(thingTwo);
|