본문 바로가기

Programming/JavaScript 0

WEB2 JavaScript - 6. Data types - Strings and Numbers

String length

The length property of a String object contains the length of the string, in UTF-16 code units. length is a read-only data property of string instances.

 

The toUpperCase() method returns the calling string value converted to uppercase (the value will be converted to a string if it isn't one).

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase

 

indexof는 ''안에 문자열에서 o가 몇 번째에 있는지 알려줌

첫번째 글자는 0부터 세야함

 

1+1은 숫자로 인식돼서 2로 계산되지만

"1"+"1"은 문자로 인식돼서 "11"로 나오는것

 

youtu.be/P8C8VNiM33A