From 3a02232a1d5e2f61a0208d3a7cee333af2ccef34 Mon Sep 17 00:00:00 2001 From: Gunashekar31742 <2400031742@kluniversity.in> Date: Tue, 25 Nov 2025 16:38:25 +0530 Subject: [PATCH 1/2] added question 477 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2a0983bd..3d6d4655 100644 --- a/README.md +++ b/README.md @@ -506,6 +506,8 @@ | 475 | [What are shadowing and illegal shadowing?](#what-are-shadowing-and-illegal-shadowing) | | 476 | [Why is it important to remove event listeners after use?](#why-is-it-important-to-remove-event-listeners-after-use) | | 477 | [What is structuredClone and how is it used for deep copying objects?](#what-is-structuredclone-and-how-is-it-used-for-deep-copying-objects) | +| 477 | [What is the difference btw == & === in java script?](#what-is-structuredclone-operators) | + From 18ab0d4cba8e38f5cef9e7588d6e57d085ae511d Mon Sep 17 00:00:00 2001 From: Gunashekar31742 <2400031742@kluniversity.in> Date: Wed, 26 Nov 2025 16:41:54 +0530 Subject: [PATCH 2/2] added 479 --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 3d6d4655..f37bb385 100644 --- a/README.md +++ b/README.md @@ -9554,6 +9554,37 @@ Common use cases and benefits: **[⬆ Back to Top](#table-of-contents)** + 479. ### What is the purpose of the at() method + + The `at()` method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array or string. + + Prior to this method, accessing the last element of an array required using array[array.length - 1]. The at() method makes this much cleaner and supports both **Arrays** and **Strings**. + + *Key Features:* + 1. *Positive Index:* Works the same as square bracket notation []. + 2. *Negative Index:* Counts from the end of the array (e.g., -1 is the last element). + + **Example:** + + ```javascript + const colors = ["Red", "Green", "Blue"]; + // Old way to get the last element + console.log(colors[colors.length - 1]); // "Blue" + + // Using at() + console.log(colors.at(-1)); // "Blue" + console.log(colors.at(-2)); // "Green" + + // It also works on Strings + const sentence = "Hello"; + console.log(sentence.at(-1)); // "o" + + // Comparing with bracket notation for negative index + console.log(colors[-1]); // undefined (Bracket notation looks for a property named "-1") + + + **[⬆ Back to Top](#table-of-contents)** + ### Coding Exercise