Okay,
I thought of this stupid little snippet of JS that has been cracking me up all day. I wanted to create a snippet of JS code that would emulate the line from the Ghostbusters theme song: "If there's something strange in your neighborhood, who you gonna call? Ghostbusters"
So this is what I came up with:
{
let somethingStrange = 1;
let neighborhood = 1;
function whoYouGonnaCall() {
if (somethingStrange === neighborhood) {
whoYouGonnaCall = 'Gohstbusters';
console.log(whoYouGonnaCall);
} else {
console.log('I ain\'t afraid of no ghost');
}
}
whoYouGonnaCall();
}
This prints Ghostbusters to the console.
I thought this would be a great learning exercise for me and others to learn something from other JS devs. I know there are more experienced JS devs out there who can put together a more creative JS snippet that expresses this same line in a different way, and I would love if you would take a crack at it.
Challenge:
Please show us how you would use JS to express:
"If there's something strange in your neighborhood, who you gonna call? Gostbusters"
Rules are:
1.) it has to work.
2.) it would be great if you explained why you chose the snippet you chose
3.) Please share an explanation of it's result.
Thanks!!
Top comments (0)