Skip to content

Instantly share code, notes, and snippets.

View AliceWonderland's full-sized avatar
:octocat:

Alice Chuang AliceWonderland

:octocat:
View GitHub Profile
@AliceWonderland
AliceWonderland / 4.2 Reverse Array.js
Created April 7, 2017 00:26 — forked from anonymous/4.2 Reverse Array.js
4.2 Reverse Array created by smillaraaq - https://repl.it/GzKo/2
function reverseArray(argArray){
var newArray=[];
var arrayLength=argArray.length-1;
for(var i=0;i<argArray.length;i++){
newArray[arrayLength]=argArray[i];
arrayLength--;
}
console.log(newArray);
@AliceWonderland
AliceWonderland / 4.1 indexOf.js
Created April 6, 2017 23:51 — forked from anonymous/4.1 indexOf.js
4.1 indexOf created by smillaraaq - https://repl.it/GzJP/1
function indexOf(argArray,argElement){
if(argArray.indexOf(argElement)){
console.log(argArray.indexOf(argElement));
}
}
indexOf([1,2,3],2);
@AliceWonderland
AliceWonderland / 3.5 Zero Dark Thirty.js
Created April 6, 2017 05:15 — forked from anonymous/3.5 Zero Dark Thirty.js
3.5 Zero Dark Thirty created by smillaraaq - https://repl.it/Gx3O/2
function removeZero(arg){
debugger;
var argToString=arg.toString();
var argToArray=argToString.split("");
while(argToArray.indexOf("0")>=0){
argToArray.splice(argToArray.indexOf("0"), 1);
}
argToString=argToArray.join("");
arg=Number(argToString);
console.log(arg);
@AliceWonderland
AliceWonderland / 3.4 Truthy.js
Created April 6, 2017 04:37 — forked from anonymous/3.4 Truthy.js
3.4 Truthy created by smillaraaq - https://repl.it/GxZN/6
function isTruthy(arg){
var theType= typeof arg;
var theBool= !!arg; //the original bool of the param
var theMessage= "";
console.log(theType+" "+theBool);
if(theType==="undefined"){
theMessage= theType+" is falsey";
}else if(theType==="null"){
theMessage= "The "+theType+" value is falsey";
}else if(theType==="boolean"){
@AliceWonderland
AliceWonderland / 3.3 How Equal.js
Created April 6, 2017 04:36 — forked from anonymous/3.3 How Equal.js
3.3 How Equal created by smillaraaq - https://repl.it/GxS5/1
function howEqual(valA, valB){
if(valA===valB){
console.log("strictly");
}else if(valA==valB){
console.log("loosely");
}else{
console.log("not equal");
}
}
howEqual(0,"0") // => "loosely"
@AliceWonderland
AliceWonderland / 3.2 FizzBuzz w Chelsea.js
Created April 6, 2017 04:36 — forked from anonymous/3.2 FizzBuzz w Chelsea.js
3.2 FizzBuzz w Chelsea created by smillaraaq - https://repl.it/GxRj/0
function fizzBuzz(num){
debugger;
for(var i = 1;i <= num ;i++){
if(!(i%3) && !(i%5)){
console.log('fizzbuzz');
} else if (!(i%3)) {
console.log('fizz');
} else if (!(i%5)) {
console.log('buzz');
} else {
@AliceWonderland
AliceWonderland / 3.1 Count by M.js
Created April 6, 2017 04:35 — forked from anonymous/3.1 Count by M.js
3.1 Count by M created by smillaraaq - https://repl.it/GxOg/4
function count(n,m,direction){
//n is limit
//m is interval
//direction up or down
if(direction==="up"){
for(var i=m; i<=n; i+=m){
console.log(i);
}
}else{
@AliceWonderland
AliceWonderland / 2.4 Bactrian Camel Case.js
Created April 6, 2017 04:34 — forked from anonymous/2.4 Bactrian Camel Case.js
2.4 Bactrian Camel Case created by smillaraaq - https://repl.it/GvLL/5
function bactrianCase(message){
var resultMessage="";
for(i=0;i<message.length;i++){
if(i%2===0){
resultMessage+=message[i].toUpperCase();
}else{
resultMessage+=message[i].toLowerCase();
}
//(i%2===0) ? resultMessage+=message[i].toUpperCase() : resultMessage+=message[i].toLowerCase();
}
@AliceWonderland
AliceWonderland / 2.3 Nickname Generator.js
Created April 6, 2017 04:34 — forked from anonymous/2.3 Nickname Generator.js
2.3 Nickname Generator created by smillaraaq - https://repl.it/GvJF/3
function nicknameGenerator(fullName){
var nickName="";
var fullNameTemp=fullName.toLowerCase();
if(fullNameTemp[2]==="a" ||
fullNameTemp[2]==="e" ||
fullNameTemp[2]==="i" ||
fullNameTemp[2]==="o" ||
fullNameTemp[2]==="u"){
//log 4 letters
nickName=fullName.slice(0,4);
@AliceWonderland
AliceWonderland / 2.2 Temperature Converter.js
Created April 6, 2017 04:34 — forked from anonymous/2.2 Temperature Converter.js
2.2 Temperature Converter created by smillaraaq - https://repl.it/GvIB/1
function converter(degrees){
var degreesCelsius = (degrees - 32) * (5 / 9);
var degreesKelvin = degreesCelsius + 273.15;
console.log(degrees + " degrees Fahrenheit");
console.log("equals " + degreesCelsius + " degrees Celsius");
console.log("equals " + degreesKelvin + " degrees Kelvin");
}
//converter(77);
function converter2(degrees){