何时在括号中使用双 quotes/single 引号?
When to use double quotes/single quotes in parentheses?
什么时候在函数中使用和不使用单引号或双引号?
例如:
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");
变量值应该在引号中,变量名不应该在引号中。
convertToInteger("56");
或
var datavalue="56";
convertToInteger(数据值);
函数内部的变量称为参数。它们用于存储您传递的项目。
当你传递它时,它会使用你输入的任何值,但如果你将一个值放在引号中,你将设置一个固定值。
什么时候在函数中使用和不使用单引号或双引号?
例如:
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");
变量值应该在引号中,变量名不应该在引号中。
convertToInteger("56");
或
var datavalue="56";
convertToInteger(数据值);
函数内部的变量称为参数。它们用于存储您传递的项目。 当你传递它时,它会使用你输入的任何值,但如果你将一个值放在引号中,你将设置一个固定值。