Pages

Monday, November 10, 2025

Template Literal in JavaScript

 1. Calculate total price using template literal.
let pencilPrice = 10;

let eraserPrice = 5;
// let output = "The total price is : " + (pencilPrice + eraserPrice) + " Rupees. ";
console.log(`The total price is : ${pencilPrice + eraserPrice} Rupees.`);

No comments:

Post a Comment

remove duplicates from sorted array - two pointer approach (leetcode)

  class Solution {     public int removeDuplicates ( int [] nums ) {         // base case: return if array have no el.         if ( nums...