◽ HTML & CSS & JS, jQuery

[JavaScript - 기능 - (10) ] 스트링값을 숫자로 바꾸기.

Number( object )

See the Pen bGdJWRX by whitekeyboard (@bfh3000) on CodePen.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
<JS>
var a = "1";
var b = "2";
var c = a + b;
var d = Number(a) + Number(b);
document.write("<h1>c : " + c + "</h1>");
document.write("<h1>d : " + d + "</h1>");
 
 
<HTML>
 
 
<html lang="ko">
 
<head>
  <meta charset="utf-8">
  <title>JavaScript</title>
  <style>
    body {
      font-family: Consolas;
    }
  </style>
</head>
<body>
</body>
</html>
 

 

푸터바