or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
:::section{.main}
The
string length
property in JavaScript returns the length of string inUTF-16
code units. It returns0
when the string is empty, , it'slength
. JavaScript uses aUTF-16
string format to depict the most common characters, consisting of a 16-bit data unit. The value returned by length does not match the number of characters in the string. When a string is empty, its length is0
.:::
:::section{.main}
Syntax
The syntax of string length property in JavaScript is:
Where
string
is the name of the string.The string length property in JavaScript doesn't take any parameters.
:::
:::section{.main}
Return Value
The string length property will return the number of characters present in the string.
:::
:::section{.main}
Examples
JavaScript Code to Show the Working of string.length Property
Output:
Assigning to length
Output:
:::
:::section{.main}
Browser compatibility
:::
:::section{.summary}
Conclusion
string length
property in JavaScript determines thelength of the string
, that is, the number of characters it contains.0
.:::