From e4d770e256a6a9b0babaa6cb3b8887079c84a429 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Fri, 22 Sep 2023 19:17:58 +0600 Subject: [PATCH] wip: add more questions --- .../javascript/content/equality-operator.md | 7 ++++++ .../question-groups/javascript/javascript.md | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/data/question-groups/javascript/content/equality-operator.md diff --git a/src/data/question-groups/javascript/content/equality-operator.md b/src/data/question-groups/javascript/content/equality-operator.md new file mode 100644 index 000000000..b3204e858 --- /dev/null +++ b/src/data/question-groups/javascript/content/equality-operator.md @@ -0,0 +1,7 @@ +The `==` equality operator converts the operands if they are not of the same type, then applies strict comparison. The `===` strict equality operator only considers values equal that have the same type. + +```js +console.log(1 == '1'); // true +console.log(1 === '1'); // false +console.log(1 === 1); // true +``` diff --git a/src/data/question-groups/javascript/javascript.md b/src/data/question-groups/javascript/javascript.md index 0b348cea2..46c6ca77d 100644 --- a/src/data/question-groups/javascript/javascript.md +++ b/src/data/question-groups/javascript/javascript.md @@ -23,4 +23,29 @@ questions: topics: - 'Core' - 'Beginner' + - question: What is the difference between `var`, `let`, and `const` in JavaScript? + answer: In JavaScript, `var` is function-scoped and was traditionally used to declare variables. `let` and `const` are block-scoped. The key difference between `let` and `const` is that `let` allows for reassignment while `const` creates a read-only reference. + topics: + - 'Core' + - 'Intermediate' + - question: What is the difference between `null` and `undefined`? + answer: The `null` is an assignment value. It can be assigned to a variable as a representation of no value. But the `undefined` is a primitive value that represents the absence of a value, or a variable that has not been assigned a value. + topics: + - 'Core' + - 'Intermediate' + - question: What is the difference between `==` and `===`? + answer: equality-operator.md + topics: + - 'Core' + - 'Intermediate' + - question: What are the different ways to declare a variable in JavaScript? + answer: There are three ways to declare a variable in JavaScript `var`, `let`, and `const`. + topics: + - 'Core' + - 'Intermediate' + - question: What are Scopes in JavaScript? + answer: A scope is a set of variables, objects, and functions that you have access to. There are three types of scopes in JavaScript. Which are Global Scope, Function Scope (Local Scope), and Block Scope. + topics: + - 'Core' + - 'Intermediate' ---