Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Angvish Kumar angvishvish

🎯
Focusing
Block or report user

Report or block angvishvish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@angvishvish
angvishvish / DashInsert.js
Created Feb 21, 2015
Have the function DashInsert(str) insert dashes ('-') between each two odd numbers in str. For example: if str is 454793 the output should be 4547-9-3. Don't count zero as an odd number.
View DashInsert.js
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);
View Mean mode.js
<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 {
View Division Stringified .js
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);
@angvishvish
angvishvish / Vowel count.js
Created Feb 20, 2015
Count the number of vowel in javascript
View Vowel count.js
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
View Factorial.js
var factorial = function (n) {
if(n == 0) { return }
return n * factorial(n-1);
} factorial(8);
View FizzBuzz.js
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);
}
}
@angvishvish
angvishvish / Division
Created Feb 20, 2015
Division by 3, 5 and both
View Division
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
var check = function (number) {
@angvishvish
angvishvish / Foundation off canvas
Last active Aug 29, 2015
Foundation off canvas
View Foundation off canvas
<!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>
You can’t perform that action at this time.