I am newbie to the JavaScript world. I have a doubt how the return statement works in JavaScript.
What I am trying to do is to have a function pass one arguments
Your example doesn't seem to need a loop. That and returning from the loop-delegate doesn't do anything for you.
You can test if a key appears in an object using the in operator.
function exampleFunction(param){ return param in exampleData ? exampleData[param] : null; }