View sortArrayOfObject.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const purchases = [ | |
{ name: 'Popcorn', price: 5.75 }, | |
{ name: 'Movie Ticket', price: 12 }, | |
{ name: 'Soda', price: 3.75 }, | |
{ name: 'Candy', price: 5 }, | |
]; | |
const sortByMapped = (map,compareFn) => (a,b) => compareFn(map(a),map(b)); | |
const byValue = (a,b) => a - b; | |
const toPrice = e => e.price; |
View Max_element_of_arrayS.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [[4, 2, 7, 1], [20, 70, 40, 90], [1, 2, 0], [1, 2, 0] , [1, 2, 0] , [1, 2, 0]]; // ➞ [7, 90, 2] | |
function findLargestNums(arr) { | |
return arr.map(x => Math.max(...x)); | |
} | |
console.log(findLargestNums(arr)) |
View classExample.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mammal { | |
constructor(sound) { | |
this._sound = sound; | |
} | |
talk() { | |
return this._sound; | |
} | |
} | |
class Dog extends Mammal { |
View reduceFunction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var orders = [ | |
{amount: 250}, | |
{amount: 300}, | |
{amount: 350}, | |
{amount: 400} | |
]; | |
// var quintyty = orders.reduce (function(sum, order) { /*sum- first arguments our callback, order- iterated item */ | |
// console.log('hello', sum , order); |
View filterFunction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var animals = [ | |
{name : 'artur', food: 'potatoes'}, | |
{name : 'sergey', food: 'fries'}, | |
{name : 'anton', food: 'fries'}, | |
{name : 'petya', food: 'cream'}, | |
{name : 'oksana', food: 'chips'}, | |
{name : 'lesya', food: 'meat'}, | |
{name : 'julya', food: 'vegies'}, | |
{name : 'sasha', food: 'sour_cream'} | |
]; |
View mapFunction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var animals = [ | |
{name : 'artur', food: 'fries'}, | |
{name : 'sergey', food: 'fries'}, | |
{name : 'anton', food: 'fries'}, | |
{name : 'petya', food: 'fries'}, | |
{name : 'oksana', food: 'fries'}, | |
{name : 'lesya', food: ''}, | |
{name : 'julya'}, | |
{name : 'sasha', food: 'fries'} | |
]; |
View JqueryPreloader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#loader { | |
background: none repeat scroll 0 0 #ffffff; | |
bottom: 0; | |
height: 100%; | |
left: 0; | |
position: fixed; | |
right: 0; | |
top: 0; | |
width: 100%; | |
z-index: 9999; |
View forInpractise.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var array = ['arg' , 'sannya' , 'katya' , 'ukr' ,'etc']; | |
for ( word in array) { | |
console.log(array[word]); | |
} |
View name.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Genius = 'AlBErt EinsTeIn' | |
function changingName(oldName){ | |
var FixedName = oldName; | |
var names = oldName.split(' '); | |
names[1] = names[1].toUpperCase(); | |
names[0] = names[0].slice(0,1).toUpperCase() + names[0].slice(1).toLowerCase(); | |
FixedName = names.join(' '); | |
return FixedName; |
View forEach.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var donuts = ['sanya', 'andrey', 'petya', 'ksusha']; | |
donuts.forEach(function(donut){ | |
donut += ' HOLE'; | |
donut = donut.toUpperCase(); | |
console.log(donut); | |
}); |