GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing it.javascript.info — Gli apici nelle stringhe

  • Tutorial
  • Il linguaggio JavaScript
  • Le basi JavaScript
  • Tipi di dato
torna alle lezioni

Gli apici nelle stringhe

importanza: 5

Qual’è l’output dello script?

let name = "Ilya";

alert( `hello ${1}` ); // ?

alert( `hello ${"name"}` ); // ?

alert( `hello ${name}` ); // ?

Il backtick viene utilizzato per integrare espressioni all’interno delle stringhe ${...}.

let name = "Ilya";

// l'espressione è il numero 1
alert( `hello ${1}` ); // hello 1

// l'espressione è la stringa "name"
alert( `hello ${"name"}` ); // hello name

// l'espressione è una variabile che viene integrata
alert( `hello ${name}` ); // hello Ilya
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.