531 B
531 B
title | localeTitle |
---|---|
Find the Length of a String | Найти длину строки |
Найти длину строки
Строки имеют атрибут (функция), называемый длиной. Все, что вам нужно сделать, это пометить его после строки / переменной.
var str1 = "Hello";
var length1 = str1.length; // This returns 5
var length2 = " Camper".length; // This returns 7 because the space is counted as one character.