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
window.onload = function(){ | |
var canvas = document.getElementById('canvas'); | |
var context = canvas.getContext('2d'); | |
canvas.width = 500; | |
canvas.height = 500; | |
function Circle(posX,posY,r,c,lw,s){ | |
this.x = posX; | |
this.y = posY; | |
this.radius = r; |
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
window.onload = function(){ | |
function Car(type, year, value){ | |
this.type = type; | |
this.year = year; | |
this.value = value; | |
this.setType = function(t){ | |
this.type = t; | |
} |
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
if(!com_yourname) | |
com_yourname = {}; | |
else if (typeof (com_yourname) != "object") | |
throw new Error("com_yourname is not an object"); |
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 Rectangle(w,h){ | |
this.width = w; | |
this.height = h; | |
} | |
/* Basic area function.*/ | |
Rectangle.prototype.area = function(){ | |
return this.width * this.height; | |
} |
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 Palindrome(str) { | |
var temp = str.split(""); | |
var temp2 = []; | |
for (i = temp.length - 1; i >= 0; i--) { | |
temp2.push(temp[i]); | |
} | |
var strtemp = temp2.join(""); | |
var strtemp2 = temp.join(""); | |
return (strtemp === strtemp2) ? true : false; | |
} |
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 temp = str.split(""); | |
var vowelcount = 0; | |
function Compare(value) { | |
var vowels = ["a", "e", "i", "o", "u"]; | |
for (i = 0; i <= vowels.length - 1; i++) { | |
if (value == vowels[i]) vowelcount++; | |
} |
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 LetterCapitalize(str) { | |
var temp = str.split(" "); | |
function Capitalize(value){ | |
var result = value.charAt(0).toUpperCase(); | |
var substring = value.substring(1, value.length); | |
var final = result+substring; | |
return final; | |
} | |
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 LetterChanges(str) { | |
var temp = str.split(""); | |
var alpha = "abcdefghijklmnopqrstuvwxyz".split(""); | |
function Change(value) { | |
var temp2; | |
if (value == "z") { | |
return temp2 = "a"; | |
} else if(value.match(/\W/g) || !isNaN(value)){ | |
return temp2 = value; |
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 ThirdLargest(sArray){ | |
var oArray = {}; | |
for(i = 0; i <= sArray.length-1; i++){ | |
oArray[sArray[i]] = sArray[i].length; | |
} | |
var sortable = []; | |
for(x in oArray){ | |
sortable.push([x, oArray[x]]); | |
} |
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 FormattedDivision(num1, num2){ | |
var quotient = num1 / num2; | |
var fixed = quotient.toFixed(4); | |
var parts = fixed.toString().split("."); | |
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); | |
return parts.join("."); | |
} |
OlderNewer