我被要求回答的问题: -
我编码的是: -
var nameString = function (name) { s="Hi,I am"+" "+name; return s; }
console.log(nameString("Neelanjana"))
它会给出错误 - "哎呀,再试一次。嗯,看起来你的nameString()函数没有返回'嗨,我是Neelanjana'为Neelanjana这个名字"
我需要做些什么来纠正代码?
答案 0 :(得分:1)
[gallery link="file" ids="2746,2743,2740,2710,2665,2663,2662"]
答案 1 :(得分:-1)
有两种修改方法: 1)
var nameString = function (name) { s="Hi,I am"+" "+name; return s; }
console.log(nameString("Neelanjana"));
2)
var nameString = function (name) { s="Hi,I am"+" "+name; return s; };console.log(nameString("Neelanjana"));
留意&#39 ;;'如果要在一行中写入,请在函数定义的末尾。
答案 2 :(得分:-1)
var nameString = function (name) { s="Hi,I am"+" "+name; return s; };
console.log(nameString("Neelanjana"))