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
function DashInsert(str) { | |
str = str.split('').map(function (item) { | |
if (item%2 != 0) { | |
return item + "-"; | |
} | |
return item; | |
}).join(''); | |
str = str.split(''); | |
return str[str.length-1]%2 == 0 ? str.join(''): str.join('').substring(0, str.length - 1); |
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
<script> | |
function MeanMode(arr) { | |
var mean = 0, mode = 0; | |
for(i=0;i < arr.length; i ++) { | |
mean+= arr[i]; | |
} | |
mean = parseInt(mean/arr.length); | |
if(arr.length%2 == 0){ | |
mid = arr.length/2 | |
} else { |
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
function DivisionStringified(num1,num2) { | |
var result = parseInt(num1/num2); | |
// code goes here | |
return result.toString().split('').length>3 ? parseInt(result/1000)+","+parseInt(result%1000):result; | |
} | |
DivisionStringified(8,8); |
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
function VowelCount(str) { | |
var count = str.split('').map(function (item) { | |
return item.match(/[aeiouAEIOU]/) ? item : ''; | |
}).join(''); | |
return count.length; | |
} | |
// keep this function call here | |
// to see how to enter arguments in JavaScript scroll down |
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 factorial = function (n) { | |
if(n == 0) { return } | |
return n * factorial(n-1); | |
} factorial(8); |
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 check = function (number) { | |
var fizz = number % 3 == 0, | |
buzz = number % 5 == 0; | |
console.log(fizz ? buzz ? "FizzBuzz" : "Fizz" : buzz ? "Buzz" : number); | |
if (number != 0) { | |
return check(number - 1); | |
} | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var check = function (number) { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Foundation</title> | |
<link rel="stylesheet" href="foundation.css"> | |
<script src="jquery-1.11.1.min.js"></script> | |
<script src="foundation.min.js"></script> | |
</head> |