From 0b19fc5884f56e58ed0aef9c98ce2839ca5ab3a8 Mon Sep 17 00:00:00 2001 From: Abrsh100 Date: Sun, 5 Oct 2025 23:11:42 +0100 Subject: [PATCH] Explaining about the = sign after the count --- Sprint-1/1-key-exercises/1-count.js | 4 ++++ Sprint-1/1-key-exercises/2-initials.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6..16caf1699 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,7 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing +// Answer +// Line 3; when we the right side first count in the right side is considerd as 0 so 0+1 will be 1. +// But the = sign does not mean the mathimatical equal, its function is to take the result on the right and store it on the left. +// Therfore if we write the same code in next line the result is not one but 2 diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f617..4a09edec5 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -5,7 +5,7 @@ let lastName = "Johnson"; // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. -let initials = ``; +let initials = `${firstName[0]}${middleName[0]}${lastName[0]}`; // https://www.google.com/search?q=get+first+character+of+string+mdn