Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Detect JavaScript Data Types</title>
</head>
<body>
  
</body>
</html>
 
function show_type(arg){
  return typeof arg;
}
console.log(show_type(5));
console.log(show_type("heroina"));
console.log(show_type(null));
console.log(show_type(function(){}));
console.log(show_type(new Date()));
console.log(show_type(false));
console.log(show_type(undefined));
var d = new Date();
document.write(d);
function find_low(arr){
  arr.sort(function(a,b){return a - b;});
  if(arr.length>2){
    return arr[1] + " ," + arr[arr.length -2];
  }else{
    return arr[1];
  }
  
}
console.log(find_low([100, 40]));
console.log(find_low([1, 5, 10, 25, 40, 100]));
console.log(find_low([5, 1, 25, 40, 10, 100]));
function perfect(numb){
  
}
var sum = [1, 2, 3].reduce((a, b) => a + b, 0);
console.log(sum); // 6
/*Write a JavaScript function to 
convert an amount to coins. Go to the editor
Sample function : amountTocoins(46, [25, 10, 5, 2, 1])
Here 46 is the amount. and 25, 10, 5, 2, 1 are coins. 
Output : 25, 10, 10, 1*/
//another
function powerBank(number, power){
  return Math.pow(number, power);
}
console.log(powerBank(4, 0));
function stringify(arg){
  
}
function random_characters(amount){
    var text = " ";
    
    var charset = "abcdefghijklmnopqrstuvwxyz0123456789";
    
    for( var i=0; i < amount; i++ )
        text += charset.charAt(Math.floor(Math.random() * charset.length));
    
    return text;
}
console.log(random_characters(3));
function comb(_array, _number){
  var n = _array.length;
  function factorial(n) {
  return (n != 1) ? n * factorial(n - 1) : 1;
}
  //return _array.length + _number;
  
}
console.log(comb([1, 2, 4], 2));
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers