“JavaScript String -Format” Code-Antworten

F String JavaScript

`string text ${expression} string text`
Nervous Nightingale

PRINTF -Anweisung in JavaScript

let soMany = 10;
console.log(`This is ${soMany} times easier!`);
// "This is 10 times easier!
Hilarious Hare

JavaScript String -Format

//

const firstName = 'john';
const lastName = 'smith';

const output = `name: ${firstName}, surname: ${lastName}`;
// name: john, surname: smith
Beautiful Bear

NodeJS -Formattext

var my_name = 'John';
var s = `hello ${my_name}, how are you doing`;
console.log(s); // prints hello John, how are you doing
Foolish Frog

JavaScript String -Format

let name = "John";
let age = 30;
let food = "pizza";

// String formating using backticks
let sentence = `${name} is ${age} years old and likes ${food}`;

console.log(sentence);
// John is 30 years old and likes pizza

// String formating using plus operator
let sentence = name + ' is ' + age + ' years old and likes ' + food;

console.log(sentence); // John is 30 years old and likes pizza
Clumsy Caiman

JavaScript String -Format

let name = "John";
let age = 30;
let food = "pizza";

// String formating using backticks
let sentence = `${name} is ${age} years old and likes ${food}`;

console.log(sentence); // John is 30 years old and likes pizza
Wicked Wryneck

Ähnliche Antworten wie “JavaScript String -Format”

Fragen ähnlich wie “JavaScript String -Format”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen