var arr = [{'id':1, 'amount':123, 'currency' : 'CHF'},{'id':2, 'amount':321, 'currency' : 'USD'},{'id':3, 'amount':4324, 'currency' : 'UAH'},{'id':4, 'amount':45645, 'currency' : 'USD'},{'id':5, 'amount':8972, 'currency' : 'CHF'}];
var result = {};
arr.forEach(function(item){
if(!result.hasOwnProperty(item.currency))
result[item.currency] = 0;
result[item.currency] += item.amount;
});
console.log(result)
//Object {CHF: 9095, USD: 45966, UAH: 4324}
.target:hover,
.target:active{
animation: rotate 0.5s ease-in-out;
}
keyframes rotate{
to{
transform:rotate(360deg);
}
}
<section>
<div class="content"></div>
</section>
section{
width: 100%;
background-color: blue;
}
.content{
margin: 0 auto;
width: 1200px;
}
<input id="phone" value="+380">
$('#phone').on('input',function(){
var val = this.value;
if(val.length<4)
this.value = '+380';
});
var scrollPosition = 0;
document.addEventListener('scroll', function(){
scrollPosition = window.pageYOffset;
console.log(scrollPosition);
});
document.getElementById('#parallaxed').style.transform = 'translateY('+scrollPosition+'px)';
[1,2,3].forEach(function(item){
console.log(item)
});
console.log(4)
//1 2 3 4
var $button = $('<button>your button</button>');
$button.css({/*your css*/});