diff --git a/README.md b/README.md index 3bccb6e..1d259dc 100644 --- a/README.md +++ b/README.md @@ -4,5 +4,3 @@ * Search for snippets that suit your needs. You can search by name, tag, language or using a snippet's description. Just start typing a term and see what comes up. * Click on each snippet card to view the whole snippet, including code, explanation and examples. -* You can copy code blocks on any snippet card, using the copy button at the top right. -* If you like the project, give it a star. It means a lot to the people maintaining it. diff --git a/javascript-array-methods.js b/javascript-array-methods.js new file mode 100644 index 0000000..c4bdbd3 --- /dev/null +++ b/javascript-array-methods.js @@ -0,0 +1,316 @@ +//Array Methods + +//concant() +const array11 = ["a", "b", "c"]; +const array21 = ["d", "e", "f"]; +const array31 = array11.concat(array21); +console.log(array31); // Expected output: Array ["a", "b", "c", "d", "e", "f"] +const result1 = array1.concat(array2, array3); + +_______________________________________________________________________________________________________________________________________________________________________________________________________ +//copyWithin() +//Copies a part of one array to another array, while doing so overwrites the copied array instead of changing the number of elements. +const array12 = ["a", "b", "c", "d", "e"]; +console.log(array12.copyWithin(0, 3, 4)); // Expected output: Array ["d", "b", "c", "d", "e"] +console.log(array12.copyWithin(1, 3)); // Expected output: Array ["d", "d", "e", "d", "e"] + +___________________________________________________________________________________________________________________________________________________________________________ +//every() +const array13 = [1, 30, 39, 29, 10, 13]; +console.log(array13.every((eleman) => eleman !== 0)); //true +const isBelowThreshold = (currentValue) => currentValue < 10; +console.log(array13.every(isBelowThreshold)); //false + +___________________________________________________________________________________________________________________________________________________________________________ +//filter() +const words = ["spray", "limit", "elite", "exuberant", "destruction", "present"]; +const result4 = words.filter((word) => word.length > 6); +console.log(result4); // Expected output: Array ["exuberant", "destruction", "present"] +const fruits = ["apple", "banana", "grapes", "mango", "orange"]; +/** + * Filter array items based on search criteria (query) + */ +function filterItems(arr, query) { + return arr.filter((el) => el.toLowerCase().includes(query.toLowerCase())); +} +console.log(filterItems(fruits, "ap")); // ['apple', 'grapes'] +console.log(filterItems(fruits, "an")); // ['banana', 'mango', 'orange'] +const array = [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; +function isPrime(num) { + for (let i = 2; num > i; i++) { + if (num % i === 0) { + return false; + } + } + return num > 1; +} +console.log(array.filter(isPrime)); // [2, 3, 5, 7, 11, 13] + +___________________________________________________________________________________________________________________________________________________________________________ +//forEach() +const array123 = ["a", "b", "c"]; +array123.forEach((element) => console.log(element)); +array123.forEach((element, index) => console.log(index + " : " + element)); +//As a result of the **map** loop, a new array is created and filled with the results of the operations performed in the loop, but **forEach** does not return a value. +const dizi = [1, 2, 3, 4]; +const yeniDizi = dizi.map(function (eleman) { + return eleman * 2; +}); + +___________________________________________________________________________________________________________________________________________________________________________ +//indexOf() +const beasts = ["ant", "bison", "camel", "duck", "bison"]; // Expected output: 1 +// Searching starting from the 2nd index. (that is, it does not see the bison in the 1st index) +console.log(beasts.indexOf("bison", 2)); // Expected output: 4 +console.log(beasts.indexOf("giraffe")); // Expected output: -1 + +___________________________________________________________________________________________________________________________________________________________________________ +//lastIndexOf() +//Returns the last index of the element searched in the array. Useful in arrays where there is more than one identical element. +const animals1 = ["Dodo", "Tiger", "Penguin", "Dodo"]; +console.log(animals1.lastIndexOf("Dodo")); // Expected output: 3 +console.log(animals1.lastIndexOf("Tiger")); // Expected output: 1 + +___________________________________________________________________________________________________________________________________________________________________________ +//map() +const array14 = [1, 4, 9, 16]; +// Pass a function to map +const map1 = array14.map((x) => x * 2); +console.log(map1); // Expected output: Array [2, 8, 18, 32] + +___________________________________________________________________________________________________________________________________________________________________________ +//reduce() +//It is an array method used to obtain results by combining or summing all elements by looping over an array. +const array15 = [1, 2, 3, 4]; +const initialValue = 0; //başlangıç değeri +const sum1 = array15.reduce((acc, curr) => acc + curr, initialValue); +//return 0+1+2+3+4 = 10 +const array155 = [1, 2, 3, 4]; +const sum2 = array1.reduce((prev, current) => { + return prev + current; +}, 2); +console.log(sum); // 0 start from 2 + 1 + 2 + 3 + 4 = 12 + +___________________________________________________________________________________________________________________________________________________________________________ +//reduceRight() +//Same as reduce just reverses from the end of the array to the beginning. +const array16 = [0, 1, 2, 3, 4]; +let sum3 = array16.reduceRight((prev, current) => prev + " - " + current); +console.log(sum3); +("4-3-2-1-0"); + +const array166 = [ + [0, 1], + [2, 3], + [4, 5], +]; +const result6 = array166.reduceRight((accumulator, currentValue) => accumulator.concat(currentValue)); +console.log(result6); // Expected output: Array [4, 5, 2, 3, 0, 1] + +const array1666 = [ + [0, 1], + [2, 3], + [4, 5], +]; +const result66 = array1666 + .map((arr) => arr.reduce((prev, current) => prev + current)) + .reduce((prev, current) => prev + current); +console.log(result66); // Expected output: 15 + +___________________________________________________________________________________________________________________________________________________________________________ +//reverse() +const array17 = ["one", "two", "three"]; +const reversed1 = array17.reverse(); +console.log(reversed1); //result ["three", "two", "one"]``` + +___________________________________________________________________________________________________________________________________________________________________________ +//toReverse() +//Reverses the applied array without changing it. +const array18 = ["one", "two", "three"]; +const reversed2 = array18.reverse(); +console.log(reversed2); //result ["three", "two", "one"] +console.log(array1); // ['one', 'two', 'three'] + +___________________________________________________________________________________________________________________________________________________________________________ +//slice() +const animals = ["ant", "bison", "camel", "duck", "elephant"]; +console.log(animals.slice(2)); // Expected output: Array ["camel", "duck", "elephant"] +console.log(animals.slice(2, 4)); // Expected output: Array ["camel", "duck"] +console.log(animals.slice(1, 5)); // Expected output: Array ["bison", "camel", "duck", "elephant"] +console.log(animals.slice(-2)); // Expected output: Array ["duck", "elephant"] +console.log(animals.slice(2, -1)); // Expected output: Array ["camel", "duck"] + +___________________________________________________________________________________________________________________________________________________________________________ +//some() +//It is used to return true if the specified condition in the array is met at least once, and false if it is never met. +[0, 1, 2, 3, 4] + .some((element) => element > 2) //return true + [(0, 1, 2, 3, 4)].some((element) => element % 2 === 0) //return true + [(0, 1, 2, 3, 4)].some((element) => element > 5); //return false + +function cbFunc(element) { + return element > 2; +} +[0, 1, 2, 3, 4].some(cbFunc); //return true + +function cbThree(element, index, arr) { + console.log(index + " : " + element); + return element.length > 7; +} + +___________________________________________________________________________________________________________________________________________________________________________ +//sort() +const months = ["Ocak", "Mart", "Şubat", "Nisan", "Ali"]; +months.sort(); +console.log(months); // return ["Ali","Mart","Nisan","Ocak","Şubat"] + +const array19 = [1, 30, 4, 21, 100000]; +array1.sort(); +console.log(array19); // Expected output: Array [1, 100000, 21, 30, 4] + +//correct orderlet numbers = [40, 100, 1, 5, 25, 10]; +numbers.sort(function (a, b) { + return a - b; //Sorts by saying a - b, if the value of a is greater than b, it can be subtracted. +}); + +console.log(numbers); // [1, 5, 10, 25, 40, 100] + +___________________________________________________________________________________________________________________________________________________________________________ +//toSort() +//Sorts back a new array without changing the original array. +let numbers11 = [40, 100, 1, 5, 25, 10]; +let newArray = numbers11.toSort(function (a, b) { + return a - b; //Sorts by saying a - b, if the value of a is greater than b, it can be subtracted. +}); +console.log(newArray); //[1, 5, 10, 25, 40, 100] + +___________________________________________________________________________________________________________________________________________________________________________ +//splice() +//array.splice(start, deleteCount, item1, item2, ...); +let fruits2 = ["elma", "armut", "portakal"]; +fruits2.splice(2, 0, "muz", "çilek"); +console.log(fruits); //["elma", "armut", "muz", "çilek", "portakal"] +let numbers = [10, 20, 30, 40, 50]; +numbers.splice(2, 2); +console.log(numbers); //[10, 20, 50] +let colors = ["kırmızı", "mavi", "yeşil", "sarı"]; +colors.splice(1, 1, "turuncu"); +console.log(colors); //["kırmızı", "turuncu", "yeşil", "sarı"] + +___________________________________________________________________________________________________________________________________________________________________________ +//entries() +//An array or object method that returns an array of key-value pairs of each element in an array or an object. Returns a new array. +const fruits3 = ["apple", "banana", "orange"]; +const entries = fruits3.entries(); +for (const entry of entries) { + console.log(entry); +} +// [0, 'apple'] +// [1, 'banana'] +// [2, 'orange'] + +___________________________________________________________________________________________________________________________________________________________________________ +//fill() +const array10 = [1, 2, 3, 4]; +console.log(array10.fill(0, 2, 4)); +// Array [1, 2, 0, 0] +console.log(array10.fill(5, 1)); +// Array [1, 5, 5, 5] +console.log(array10.fill(6)); +//Array [6, 6, 6, 6] + +___________________________________________________________________________________________________________________________________________________________________________ +//find() +const array111 = [5, 12, 8, 130, 44]; +const found1 = array1.find((element) => element > 10); +console.log(found1); // Expected output: 12 + +const array112 = [ + { id: 1, name: "kadir" }, + { id: 2, name: "süleyman" }, + { id: 3, name: "coşkun" }, +]; + +const found2 = array112.find(({ id }) => id > 1); +console.log(found); // Expected output: return object {id: 2, name: "süleyman"} + +___________________________________________________________________________________________________________________________________________________________________________ +///findIndex() +const array113 = [5, 12, 8, 130, 44]; +const isLargeNumber1 = (element) => element > 13; +console.log(array1.findIndex(isLargeNumber1)); // Expected output: 3 + +___________________________________________________________________________________________________________________________________________________________________________ +//findLast() +const array114 = [5, 12, 50, 130, 44]; +const found = array114.find((element) => element > 45); +console.log(found); // Expected output: 130 + +___________________________________________________________________________________________________________________________________________________________________________ +//findLastIndex() +const array115 = [5, 12, 50, 130, 44]; +const isLargeNumber = (element) => element > 45; +console.log(array115.findLastIndex(isLargeNumber)); // Expected output: 3 + +___________________________________________________________________________________________________________________________________________________________________________ +//includes() +const pets = ["cat", "dog", "bat", 12]; +console.log(pets.includes(12)); //true +console.log(pets.includes("a")); //true +console.log([0, 1, , 2].includes(undefined)); //true + +___________________________________________________________________________________________________________________________________________________________________________ +//join() +const elements = ["Fire", "Air", "Water"]; +console.log(elements.join()); // "Fire,Air,Water" +console.log(elements.join("")); // "FireAirWater" +console.log(elements.join("-")); // "Fire-Air-Water" +console.log([1, undefined, 3].join()); // '1,,3' + +___________________________________________________________________________________________________________________________________________________________________________ +//keys() +const array1 = ["a", "b", , "c"]; +const ite = Object.keys(array1); +console.log(ite); // ["0","1","3"] +const ite2 = Object.keys(array1); +console.log(...ite2); // "0","1","2" + +___________________________________________________________________________________________________________________________________________________________________________ +//toLocaleString() +let date = new Date(); +console.log(date); //return "2023-07-31T06:39:18.979Z" +console.log(date.toLocaleString("tr-TR")); //return "31.07.2023 09:39:18" + +___________________________________________________________________________________________________________________________________________________________________________ +//pop() +const myArray1 = [1, 2, 3, 4, 5]; +const removedElement = myArray1.pop(); +console.log(removedElement); // 5 (kaldırılan eleman) +console.log(myArray1); // [1, 2, 3, 4] (kalan dizinin son hali) +const emptyArray = []; +console.log(emptyArray.pop()); // undefined + +___________________________________________________________________________________________________________________________________________________________________________ +//shift() +const myArray2 = [1, 2, 3, 4, 5]; +console.log(myArray2.shift()); // 1 (kaldırılan eleman) +console.log(myArray2); // [2, 3, 4, 5] (kalan dizinin son hali) +console.log(emptyArray.shift()); // undefined + +___________________________________________________________________________________________________________________________________________________________________________ +//push() +const myArray3 = [1, 2, 3, 4]; +console.log(myArray3.push(5, 6)); // 6 (yeni dizi uzunluğu) +console.log(myArray3); // [1, 2, 3, 4, 5, 6] (kalan dizinin son hali) +const myArray4 = [1, 2]; +const additionalItems4 = [3, 4, 5]; +myArray4.push(...additionalItems); +console.log(myArray4); // [1, 2, 3, 4, 5]``` + +___________________________________________________________________________________________________________________________________________________________________________ +//unshift() +const myArray = [3, 4, 5]; +console.log(myArray.unshift(1, 2)); // [1, 2, 3, 4, 5] +const additionalItems = [0, -1]; +myArray.unshift(...additionalItems); + diff --git a/javascript-number-methods.js b/javascript-number-methods.js new file mode 100644 index 0000000..9d7f66c --- /dev/null +++ b/javascript-number-methods.js @@ -0,0 +1,121 @@ +//Number Methods + +//Number(), + , parseInt(), parseFloat() + +Console.log(Number("123")); // return 123 (convert string to number) +console.log(+"123"); // return 123 (convert string to number) +console.log(parseInt("123")); // return 123 (convert string to number) +console.log(parseInt("12.34")); // return 12 +console.log(parseFloat("12.34")); // return 12.34 (convert string to number) + +___________________________________________________________________________________________________________________________________________________________________________ +//toString() +const nbr = 15 +console.log(nbr.toString()) // return 15 + +___________________________________________________________________________________________________________________________________________________________________________ +//toFixed() +const n1 = 214.45 +console.log(n1.toFixed(1));// "214.4" +console.log(n1.toFixed(4));// "214.4500" +console.log(+n1.toFixed(4));// 214.4500 + +___________________________________________________________________________________________________________________________________________________________________________ +//toPrecision() +let num = 3.14159; +let formattedNum = num.toPrecision(4); // '3.142' +let integerNum = 42; +let formattedInt = integerNum.toPrecision(4); // '42.00' + +___________________________________________________________________________________________________________________________________________________________________________ +//toLocaleString() +const n2 = 1800000; +console.log(n2.toLocaleString());// return "1.800.000" +console.log(n1.toLocaleString("tr-TR"));// return "1.800.000" + +___________________________________________________________________________________________________________________________________________________________________________ +//Number.isInteger() +console.log(Number.isInteger(24)); // true +console.log(Number.isInteger(24.00)); // true +console.log(Number.isInteger(24.04)); // false +console.log(Number.isInteger([1,2,3])); // false +console.log(Number.isInteger("24")); // false + +___________________________________________________________________________________________________________________________________________________________________________ +//All Math Functions + +//Math.abs() +console.log(Math.abs(5)); // 5 +console.log(Math.abs(-5)); // 5 +console.log(Math.abs(0)); // 0 +console.log(Math.abs(-3.14)); // 3.14 +console.log(Math.abs("42")); // 42 +console.log(Math.abs("Hello")); // NaN + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.ceil() +console.log(Math.ceil(0.95)); // Expected output: 1 +console.log(Math.ceil(4)); // Expected output: 4 +console.log(Math.ceil(7.004)); // Expected output: 8 +console.log(Math.ceil(-7.004)); // Expected output: -7 + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.floor() +console.log(Math.floor(5.95));// Expected output: 5 +console.log(Math.floor(5.05));// Expected output: 5 +console.log(Math.floor(5));// Expected output: 5 +console.log(Math.floor(-5.05));// Expected output: -6 + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.max() +console.log(Math.max(5, 10, 15, 20)); // 20 +console.log(Math.max(-5, 3, -10, 8)); // 8 +console.log(Math.max(0, 0, 0, 0)); // 0 +console.log(Math.max(3.14, 2.71, 1.618)); // 3.14 +console.log(Math.max("42", "100", "7")); // 100 +console.log(Math.max(10, "Hello", -8)); // 10 +console.log(Math.max()); // -Infinity + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.min() +console.log(Math.min(5, 10, 15, 20)); // 5 +console.log(Math.min(-5, 3, -10, 8)); // -10 +console.log(Math.min(0, 0, 0, 0)); // 0 +console.log(Math.min(3.14, 2.71, 1.618)); // 1.618 +console.log(Math.min("42", "100", "7")); // 7 +console.log(Math.min(10, "Hello", -8)); // -8 +console.log(Math.min()); // Infinity + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.pow() +console.log(Math.pow(2, 3)); // 8 - 2^3 = 2 * 2 * 2 = 8 +console.log(Math.pow(5, 2)); // 25 - 5^2 = 5 * 5 = 25 +console.log(Math.pow(10, 0)); // 1 +console.log(Math.pow(3, -2)); // 0.1111111111111111 - 3^(-2) = 1 / (3^2) = 1 / 9 = 0.1111111111111111 +console.log(Math.pow(4, 0.5)); // 2 - 4^(0.5) = Karekök(4) = 2 + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.random() +const randomNumber = Math.random(); +console.log(randomNumber); // 0.7267456282563128 +const randomBetween0And10 = Math.random() * 10; +console.log(randomBetween0And10); // 7.267456282563128 +const randomIntBetween1And100 = Math.floor(Math.random() * 100) + 1; +console.log(randomIntBetween1And100); // 42 + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.round() +console.log(Math.round(3.2)); // 3 +console.log(Math.round(6.8)); // 7 +console.log(Math.round(1.5)); // 2 +console.log(Math.round(2.4)); // 2 +console.log(Math.round(-3.7)); // -4 + +___________________________________________________________________________________________________________________________________________________________________________ +//Math.sing() +console.log(Math.sign(5)); // 1 +console.log(Math.sign(-5)); // -1 +console.log(Math.sign(0)); // 0 +console.log(Math.sign("42")); // 1 +console.log(Math.sign("-3.14")); // -1 +console.log(Math.sign("Hello")); // NaN \ No newline at end of file diff --git a/javascript-objects-methods.js b/javascript-objects-methods.js new file mode 100644 index 0000000..a4d3bb3 --- /dev/null +++ b/javascript-objects-methods.js @@ -0,0 +1,200 @@ +//Object Methods + +/*In JavaScript, an "object" is a data structure that groups multiple values or properties and facilitates access to those properties. +Objects contain named property-value pairs and can also contain methods such as functions. +This forms the basis of object-oriented programming and allows you to keep data in a more organized and structured way.*/ + +//Object create a function in +const person = { + name: "John", + greet: function () { + console.log("hello"); + }, +}; + +___________________________________________________________________________________________________________________________________________________________________________ +//Object assigning value from outside +let student = {}; +student.name = "John"; +student.greet = function () { + console.log("hello"); +}; +student.greet(); // hello + +___________________________________________________________________________________________________________________________________________________________________________ +//delete +//It allows us to delete a value inside the object. +const user = { + username: "AzureDiamond", + password: "hunter2", +}; +delete user.username; +console.log(user); // {"password": "hunter2"} + +___________________________________________________________________________________________________________________________________________________________________________ +//this keyword +//We can use the this keyword to access a property of an object from within a method of the same object. +const person1 = { + name: "John", + age: 30, + + // accessing name property by using this.name + greet: function () { + console.log("The name is" + " " + this.name); + }, +}; +person1.greet(); + +___________________________________________________________________________________________________________________________________________________________________________ +//Also, when accessing values defined inside the function without using this, we use the this keyword to refer to the values inside the object. +const person2 = { + name: "John", + surname: "Deep", + greet: function () { + let surname = "Doe"; + console.log("The name is" + " " + this.name + " " + surname); + }, + greet2: function () { + let surname = "Doe"; + console.log("The name is" + " " + this.name + " " + this.surname); + }, +}; +person2.greet(); // "The name is John Doe" +person2.greet2(); // "The name is John Deep" + +___________________________________________________________________________________________________________________________________________________________________________ +//Object.keys +//Creates an array containing the keys of an object. +const employees = { + boss: "Michael", + secretary: "Pam", + sales: "Jim", + accountant: "Oscar", +}; +console.log(Object.keys(employees)); // ["boss", "secretary", "sales", "accountant"] + +___________________________________________________________________________________________________________________________________________________________________________ +// Object.values +//Creates an array containing the values of an object. +const session = { + id: 1, + time: `26-July-2018`, + device: "mobile", + browser: "Chrome", +}; +console.log(Object.values(session)); // [1, "26-July-2018", "mobile", "Chrome"] + +const operatingSystem = { + name: "Ubuntu", + version: 18.04, + license: "Open Source", +}; + +console.log(Object.entries(operatingSystem)); +// output : +`[["name", "Ubuntu"][("version", 18.04)][("license", "Open Source")]];` + +___________________________________________________________________________________________________________________________________________________________________________ +const operatingSystem1 = { + name: "Ubuntu", + version: 18.04, + license: "Open Source", +}; +for (let [key, value] of Object.entries(operatingSystem1)) { + console.log(key + " = " + value); +} +// output : +("name = Ubuntu"); +("version = 18.04"); +("license = Open Source"); + +___________________________________________________________________________________________________________________________________________________________________________ +//Object.assign() +//Used to combine values of multiple objects +const name1 = { + firstName: "Philip", + lastName: "Fry", +}; + +const details1 = { + job: "Delivery Boy", + employer: "Planet Express", +}; +console.log(Object.assign(name1, details1)); +// output : +`{firstName: "Philip", lastName: "Fry", job: "Delivery Boy", employer: "Planet Express"}`; + +___________________________________________________________________________________________________________________________________________________________________________ +//It is also possible to combine with the spread. +const name2 = { + firstName: "Philip", + lastName: "Fry", +}; + +const details = { + job: "Delivery Boy", + employer: "Planet Express", +}; +const character = { ...name2, ...details }; + +___________________________________________________________________________________________________________________________________________________________________________ +//Object.freeze() +//Prevents changing, deleting and adding values in the specified object. +const user2 = { + username: "AzureDiamond", + password: "hunter2", +}; + +const newUser = Object.freeze(user2); + +newUser.password = "*******"; +newUser.active = true; +console.log(newUser); // {username: "AzureDiamond", password: "hunter2"} + +___________________________________________________________________________________________________________________________________________________________________________ +//Object.seal() +//Allows the values in the specified object to be changed, but prevents adding and deleting values. +const user3 = { + username: "AzureDiamond", + password: "hunter2", +}; + +const newUser = Object.seal(user3); +newUser.password = "*******"; +newUser.active = true; //eklenmez +delete newUser.username; //silinmez +console.log(newUser); // {username: "AzureDiamond", password: "*******"} + +___________________________________________________________________________________________________________________________________________________________________________ +//shorthand +//We can define your object methods in a more practical way without assigning keywords. +// We assigned a function to greet and now we can call this function as greet. +let person3 = { + firstName: "John", + lastName: "Doe", + greet: function () { + console.log("Hello, World!"); + }, +}; +person3.greet(); // "Hello, World!"; + +___________________________________________________________________________________________________________________________________________________________________________ +// when we create the function directly without defining a keyword +// The function name and keyword are automatically created inside +let person5 = { + firstName: "John", + lastName: "Doe", + greet() { + console.log("Hello, World!"); + }, +}; +person5.greet(); //Hello, World!" + +___________________________________________________________________________________________________________________________________________________________________________ +//Object.getPrototypeOf() +//Object.getPrototypeOf() is used to get the internal hidden [[Prototype]] of an object, also accessible through the __proto__ property. +const employees1 = ["Ron", "April", "Andy", "Leslie"]; +Object.getPrototypeOf(employees1); +//Output +//[constructor: ƒ, concat: ƒ, find: ƒ, findIndex: ƒ, pop: ƒ, …] +