Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
このコードブロックを試すと、なぜ:
var str = "1234"; alert(str.toString().lenght);
それは私に「未定義」と警告しますか?
つづりを間違えlengthました。それは「長さ」です:
length
str.toString().length
toString()ただし、実際にはここで呼び出す必要はありません。"1234"はすでに文字列であるため、同様にstr.length機能します。
toString()
"1234"
str.length