-
PropertiesStudy/JavaScript 2020. 4. 28. 22:11
Properties
When you introduce a new piece of data into a JavaScript program, the browser saves it as an instance of the data type. Every string instance has a property called length that stores the number of characters in that string. You can retrieve property information by appending the string with a period and the property name:
console.log('Hello'.length); // Prints 5
The . is another operator! We call it the dot operator.
In the example above, the value saved to the length property is retrieved from the instance of the string, 'Hello'. The program prints 5 to the console, because Hello has five characters in it.
Instructions
'Study > JavaScript' 카테고리의 다른 글
Create a Variable: let (0) 2020.04.29 Create a Variable: var (0) 2020.04.29 Data Types (0) 2020.04.28 Comments (0) 2020.04.28 error:: Cannot read property () of null 넌.. 누구니...?! (0) 2020.04.23