diff --git a/basics/basic.js b/basics/basic.js new file mode 100644 index 00000000..fada2aee --- /dev/null +++ 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/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"; 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.