14 lines
447 B
Markdown
14 lines
447 B
Markdown
![]() |
---
|
||
|
title: Find the Length of a String
|
||
|
localeTitle: Encontre o comprimento de uma string
|
||
|
---
|
||
|
## Encontre o comprimento de uma string
|
||
|
|
||
|
As cordas têm um **atributo** (recurso) chamado 'comprimento'. Tudo o que você precisa fazer é marcá-lo após a string / variável.
|
||
|
```
|
||
|
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.
|
||
|
|
||
|
```
|