Created
February 20, 2022 01:01
-
-
Save Tomokatsu-Sakamoto/6a704f01db2fb237ab7cb34c7fb28d99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunction() { | |
// ダブルクォーテーションの中には、シングルクォーテーションが表記できる | |
let mes1 = "’90 に"; // 文字列の両端は "(ダブルクォーテーション)でもOK | |
console.log( mes1 ); | |
// シングルクォーテーションの中には、ダブルクォーテーションが表記できる | |
let mes2 = '"山" と'; // 文字列の両端は ’(シングルクォーテーション)でもOK | |
console.log( mes2 ); | |
// \(バックスラッシュ:半角文字の¥)を書くとダブルクォーテーションの中にもダブルクォーテーションが表記できる | |
let mes3 = "\"川\" と"; | |
console.log( mes3 ); | |
// `(バッククォート)で囲むのも OK | |
let mes4 = `この中には " も ' だって記述できる。\` はエスケープが必要`; | |
console.log( mes4 ); | |
let mes5 = `${mes1}は ${mes2}${mes3} "海" に遊びに行った。`; | |
console.log( mes5 ); | |
let mes6 = `${mes1}は | |
${mes2} | |
${mes3} | |
"海" に遊びに行った。`; | |
console.log( mes6 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment