1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

javascriptで文字列を数値に変換する簡単な方法

Last updated at Posted at 2014-12-29

文字列から数値への変換は
parseInt()等を使っても出来ますが
もっと簡単に出来ます。
その方法は値の前にプラスを付けるだけです。

var numberValue = 3;
var strValue = '4';

var a = +numberValue; // a is number
var b = +strValue;    // b is number

ちょー楽ちん。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?