console.log("2, 3, 5, 7, 11")
function GetNumbers(n){
var nums = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199];
return nums.slice(0, Math.max( 0, Math.min(n, nums.length) ) ).join(', ');
}
console.log( GetNumbers(5) );
2, 3, 5, 7, 11
<div>
<div class="div2"></div>
<div class="div2"></div>
<div class="div2"></div>
</div>
function el(e) {
var target = e.target
, arr = target.parentNode.children
, len = arr.length
, i = 0
, elementIndex = null
;
for(; i<len; i++){
if(arr[i] === target){
elementIndex = i;
break;
}
}
console.log('elementIndex: ', elementIndex);
}
window.addEventListener("click", el);
moment.min(["25.02.2010 17:00", "23.08.2011 18:47", "03.12.2009 11:08", "15.02.2010 17:06"])
moment.max(["25.02.2010 17:00", "23.08.2011 18:47", "03.12.2009 11:08", "15.02.2010 17:06"])
Sometimes, you want all the goodness of moment#from but you don't want to have to create two moments, you just want to display a length of time.
moment.duration(1, "minutes").humanize(); // a minute
moment.duration(2, "minutes").humanize(); // 2 minutes
moment.duration(24, "hours").humanize(); // a day
moment.duration(22, "hours") + "hours"