When to use and not use single or double quotes within functions?
for example:
function convertToInteger(str) {
return parseInt(str); // why do we not use double-quotes here? is this as simple as we never use quotes around arguments when calling a function?
}
convertToInteger("56");
the variables inside the function are called arguments. They serve to store the item you passed. As you passed it, it will use whatever value you enter, but if you put a value in quotes, you would be setting a fixed value.
Variable value should be in quotes , variable name should not be in quotes .
convertToInteger("56");
or
var datavalue="56";
convertToInteger(datavalue);