node.js 자바스크립트에서 문자 갯수를 구하는 기초를 연습한다.


아래 문자의 갯수를 구할때 변수와 console.log를 이용해 구해본다.

abc 123 sgsdg gsghsrgawh wgg grrr egg affdfdsf f fsddds 890


var str1 = 'abc 123 sgsdg gsghsrgawh wgg grrr egg affdfdsf f fsddds 890'

var n = str1.length ; //str1의 글자 갯수 확인 .length

console.log(n);


위 처럼 변수를 써서 하거나 조금 무식하게(?)


console.log('abc 123 sgsdg gsghsrgawh wgg grrr egg affdfdsf f fsddds 890.length');


를 해도 된다.



+ Recent posts