[SOLVED] When to use double quotes/single quotes in parentheses?

Issue

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");

Solution

Variable value should be in quotes , variable name should not be in quotes .

convertToInteger("56");

or

var datavalue="56";

convertToInteger(datavalue);

Answered By – Dhirendra

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *