From 7083d77a9fb1214f48a9135669041c6ee9139424 Mon Sep 17 00:00:00 2001 From: UniversalDon <56935053+UniversalDon@users.noreply.github.com> Date: Thu, 24 Oct 2019 00:03:38 +0530 Subject: [PATCH 1/2] Create GoodLearning --- GoodLearning | 1 + 1 file changed, 1 insertion(+) create mode 100644 GoodLearning diff --git a/GoodLearning b/GoodLearning new file mode 100644 index 0000000..1607908 --- /dev/null +++ b/GoodLearning @@ -0,0 +1 @@ +Thanks to seniors for teaching JS From 6c093a5cc8c76099d3aef9fd8a285582882ddb45 Mon Sep 17 00:00:00 2001 From: Khiladi2020 <54790775+Khiladi2020@users.noreply.github.com> Date: Fri, 2 Oct 2020 22:41:52 +0530 Subject: [PATCH 2/2] added updated examples for use of users --- uses.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 uses.txt diff --git a/uses.txt b/uses.txt new file mode 100644 index 0000000..d115904 --- /dev/null +++ b/uses.txt @@ -0,0 +1,17 @@ +Class declarations +One way to define a class is using a class declaration. To declare a class, you use the class keyword with the name of the class ("Rectangle" here). + +class Rectangle { + constructor(height, width) { + this.height = height; + this.width = width; + } +} +Hoisting +An important difference between function declarations and class declarations is that function declarations are hoisted and class declarations are not. You first need to declare your class and then access it, otherwise code like the following will throw a ReferenceError: + +const p = new Rectangle(); // ReferenceError + +class Rectangle {} +Class expressions +A class expression is another way to define a class. Class expressions can be named or unnamed. The name given to a named class expression is local to the class's body. (it can be retrieved through the class's (not an instance's) name property, though).