Random Number javascript

tipjs,random

Random Number javascript

function GetRandomNum(Min,Max)
{
var Range = Max - Min;
var Rand = Math.random();
return(Min + Math.round(Rand * Range));
}
var num = GetRandomNum(10000,999999);
alert(num);

Có thể bạn đã miss một số snippets code

Sử dụng reduce và concat làm phẳng một array

Array.reduce() và Array.concat() có thể giúp chúng ta làm phẳng một Array như:

Merge Array

How to combine two sorted arrays into one? We can do this easily with the spread operator.

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below

Copy a string to the clipboard

Copy a string to the clipboard. Only works as a result of user action (i.e. inside a click event listener).

Callback in javascript

Callback in javascript