4
2

More than 5 years have passed since last update.

シングルクオートとダブルクオートの違い

Last updated at Posted at 2018-03-25

シングルクオートとダブルクオートの違い とは?

ずばり、ない。

使いわけとしては、
「parameterなどでダブルクオーテーションが使われていれば、
それらはシングルクオーテーションでくくってやろう。」

こんな感じ。

var hoge = '{"name":"ken","id":12345}';

扱う文字列(ここでは {"name":"ken","id":12345} )に
ダブルクオーテーションが含まれるため、もしくはダブルクオーテーションを使いたいとき、
シングルクオーテーションを使う。

逆もしかり。

4
2
2

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
4
2