【发布时间】:2019-07-24 21:45:58
【问题描述】:
我正在学习编码,并且我已经在这个项目上工作了一个多小时。字符串长度属性的代码不正确。
//我试过了:
length.length;
num.toString(); //"6"
length.length; //6
//////下面是练习题
function exerciseThree(str){
// In this exercise, you will be given a variable, it will be called: str
// On the next line create a variable called 'length' and using the length property assign the new variable to the length of str
var length = 'length';
length.length;
// Please write your answer in the line above.
return length;
【问题讨论】:
-
我对@987654324@ 的来源以及问题所在感到困惑。字符串
length的长度应该是6,那有什么问题呢? -
@Sabrina73 stackoverflow 并非旨在帮助您解决作业。见How to ask。练习中的代码 cmets 会告诉您该做什么。它有一个名为
length的变量并接收一个名为str的字符串参数。练习要求您将str变量的长度存储到length变量中。 -
@LéaGris - 对于初学者学习编码的人来说,最好的地方是什么? :) 因为我会不时需要帮助。谢谢!
-
可能是给你这个练习的人......