const age = 3
console.log(`I'm ${age} years old!`)
JavaScript string interpolation is the process of embedding an expression into part of a string.
const number = 42;
const message = `The number is ${number}`;
message; // => 'The number is 42'
const firstname = "John";
const lastname = "Doe";
alert(`Hello ${firstname} ${lastname}!`);
var name = "Taimoor";
var country = "Pakistan";
// string interpolation
console.log(`I am ${name} and I am from ${country}`);
const apples = 4;
const bananas = 3;
console.log(`I have ${apples} apples`);
console.log(`I have ${apples + bananas} fruit`);
const name = "John";
console.log(`Welcome ${name}.
You have ${2 * 5} new notifications!`);
const name = 'Jack';
console.log('Hello ' + name); // Hello Jack
Code Example |
---|
Javascript :: |
:: |
:: vue watch |
Javascript :: change photo with js |
Javascript :: |
Javascript :: jquery get id of 3rd parent |
Javascript :: |
Javascript :: |
Javascript :: formating decimal hours as hours and minute javascript |
:: |
:: |
Javascript :: |
:: |
Javascript :: |
Javascript :: html js hide or show iframe |
:: |
Javascript :: |
Javascript :: |
Javascript :: canvas draw rect dashed |
Javascript :: |
Javascript :: angular two way binding |
:: javascript && operator |
Javascript :: |
Javascript :: flysystem-aws |
:: |
Javascript :: how to give index in query selector in js |
Javascript :: node.js process.argv |
:: |
:: js.l2 |
Javascript :: axios.get Uncaught (in promise) TypeError: response.json is not a function |