-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharrays-Properties.js
More file actions
45 lines (31 loc) 路 845 Bytes
/
Copy patharrays-Properties.js
File metadata and controls
45 lines (31 loc) 路 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//* 1. array.prototype
// prototype allow you to add new properties and methods to arrays().
// prototype is a property available with all javascript object.
//! syntax
// Array.prototype.name = value;
Array.prototype.myUcase = function () {
for (let i = 0; i < this.length; i++) {
console.log(this[i]);
}
};
const names = ["Rogers", "Manish", "Kalki", "KaliPurush"];
names.myUcase();
// Rogers
// Manish
// Kalki
// KaliPurush
//! you should not change prototype of built in js datatypes like:
// Numbers
// Strings
// Arrays
// Dates
// Booleans
// Function
// Objects
//! Only Changes the prototype of your own objects
//* 2.length
// A Function object's length property indicates the numebr of parameter expected by the function
function func(name, lastname, age){
// body of function
}
console.log(func.length) // 3