You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+102-3Lines changed: 102 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,8 +131,7 @@ ECMA was created to standardize JavaScript to help foster multiple independent
131
131
The full form of ECMA is European Computer Manufacturer's Association.A standard for scripting languages like JavaScript, JScript is ECMAScript.
132
132
133
133
Here NodeJS follow the ECMA standard, here we are going to dicuss about Const, Let and class.
134
-
135
-
Unlike variables declared with var that are function-scoped, variables declared with let are block-scoped: they only exist in the block they are defined in.
134
+
> <b>let :</b> Unlike variables declared with var that are function-scoped, variables declared with let are block-scoped: they only exist in the block they are defined in.
136
135
137
136
```ruby
138
137
var a =20
@@ -152,7 +151,7 @@ var v = () => {
152
151
v();
153
152
154
153
```
155
-
Diffrence in Var and Let
154
+
Difference in Var and Let
156
155
157
156
158
157
|Var | let |
@@ -161,6 +160,106 @@ Diffrence in Var and Let
161
160
|var variables are added to the global object as properties. The global object is window on the web browser and global on Node.js: |However, the let variables are not added to the global object|
162
161
|The var keyword allows you to redeclare a variable without any issue.| If you redeclare a variable with the let keyword, you will get an error|
163
162
163
+
164
+
> <b>Const :</b> Variables defined with const behave like let variables, except they cannot be reassigned. <br />
165
+
166
+
If we assign a primitive value to a constant, we cannot change the primitive value:
167
+
168
+
169
+
```ruby
170
+
const a =30;
171
+
//a =40; // you can not assign the a to another value
172
+
173
+
console.log(a);
174
+
175
+
```
176
+
177
+
You can change the properties of a constant object:
178
+
179
+
```ruby
180
+
181
+
// but if you defined the object and want to change the value of it tha you can do that
> <b>Class :</b> Its type of function, but instead of using function keyword to initiate it, here use the keyword class, and the properties are assigned inside a constructor() method. <br />
194
+
195
+
```ruby
196
+
classTestUserClass
197
+
{
198
+
constructor()
199
+
{
200
+
this.name ="Satya first ";
201
+
this.phoneNumber ="6776777"
202
+
}
203
+
204
+
getName()
205
+
{
206
+
//console.log(name); // this will give error to access any of the class values you need to use thi.
207
+
console.log(this.name);
208
+
this.age =12
209
+
return this.name;
210
+
}
211
+
212
+
getAge()
213
+
{
214
+
return this.age;
215
+
}
216
+
}
217
+
218
+
219
+
var tc =newTestUserClass();
220
+
//tc.getName();
221
+
console.log(tc.getAge()); // you need to call the Get name first as the Age setting their.
222
+
```
223
+
224
+
## Day 5 - Prototype
225
+
226
+
In the previous chapter we learned how to use an object constructor.
227
+
228
+
Sometimes you want to add new properties (or methods) to all existing objects of a given type.
229
+
Sometimes you want to add new properties (or methods) to an object constructor.
230
+
231
+
Prototype property in Javascript allows you to add new properties to object constructors.
232
+
233
+
```ruby
234
+
// prototype usese to extend the functionalty of exiting function.
235
+
236
+
var Employee= function()
237
+
{
238
+
this.name ="Satya";
239
+
this.age =30;
240
+
241
+
242
+
}
243
+
244
+
245
+
var e =newEmployee();
246
+
console.log(e.age);
247
+
248
+
Employee.prototype = {
249
+
phoneNumber : "4545454",
250
+
251
+
GetAge : function()
252
+
{
253
+
return this.name;
254
+
}
255
+
}
256
+
257
+
var e =newEmployee();
258
+
console.log(e.age);
259
+
console.log(e.phoneNumber);
260
+
console.log(e.GetAge());
261
+
```
262
+
164
263
## Day 10 - ExpressJs
165
264
166
265
ExpressJs use to build the Node Application, it make faster the devlopment and provide inbuild code for development.<br /><br />
0 commit comments