From 0378c01e066b4eba512e260396648d24942c55fc Mon Sep 17 00:00:00 2001 From: Akash Shrivas <62471342+akashshrivas@users.noreply.github.com> Date: Mon, 17 Jul 2023 14:52:08 +0530 Subject: [PATCH 1/2] Added Shortcut for Commenting in Js. --- basics/basic.js | 0 basics/comments.md | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 basics/basic.js diff --git a/basics/basic.js b/basics/basic.js new file mode 100644 index 00000000..e69de29b diff --git a/basics/comments.md b/basics/comments.md index 95b56fd7..285c0118 100644 --- a/basics/comments.md +++ b/basics/comments.md @@ -6,6 +6,11 @@ In Javascript, comments can be written in 2 different ways: - Line starting with `//`: +Keyboard Shortcuts for commenting a line : + For Windows (Single Line Comment) --> Ctrl + / + For Windows (Multi Line Comment) --> Shift +Alt +A + For Mac --> Command + / + ```javascript // This is a comment, it will be ignored by the interpreter var a = "this is a variable defined in a statement"; From 48a77e7d27e44917c6f0fd1386868362748b2a51 Mon Sep 17 00:00:00 2001 From: Akash Shrivas <62471342+akashshrivas@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:07:21 +0530 Subject: [PATCH 2/2] Elaborating the example of equality Operator . --- basics/basic.js | 4 ++++ basics/equality.md | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/basics/basic.js b/basics/basic.js index e69de29b..fada2aee 100644 --- a/basics/basic.js +++ b/basics/basic.js @@ -0,0 +1,4 @@ +let a = 101; +let b = "101"; + +console.log(a===b) \ No newline at end of file diff --git a/basics/equality.md b/basics/equality.md index 8561977d..3cac718b 100644 --- a/basics/equality.md +++ b/basics/equality.md @@ -11,6 +11,13 @@ var foo = 42; var bar = 42; var baz = "42"; var qux = "life"; + +// Another Example of `===` +var abc = 101; +var def = "101"; +// CASE 1 : `==` +```In case 1 output will be true because "==" operator only checks var are equal +Case 2: '===' this operators also check its type(datatype). In our case abc is integer and def is a string so output will be false.``` ``` `foo == bar` will evaluate to `true` and `baz == qux` will evaluate to `false`, as one would expect. However, `foo == baz` will _also_ evaluate to `true` despite `foo` and `baz` being different types. Behind the scenes the `==` equality operator attempts to force its operands to the same type before determining their equality. This is in contrast to the `===` equality operator.