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
!!! 5 | |
/[if lt IE 7] <html lang="en" class="no-js ie6"> | |
/[if IE 7 ] <html lang="en" class="no-js ie7"> | |
/[if IE 8 ] <html lang="en" class="no-js ie8"> | |
/[if IE 9 ] <html lang="en" class="no-js ie9"> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> | |
%head | |
%meta{:charset => "utf-8"}/ | |
/ | |
Always force latest IE rendering engine (even in intranet) & Chrome Frame |
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
// Define a function findLargestNumber() that takes an argument | |
// from a list of numbers as and returns the largest of them. | |
// Use the if condition to get the largest number from the list. | |
// https://jsfiddle.net/3v3LoLrp/ | |
function findLargestNumber(numbers){ | |
var largestNum = 0 ; | |
for (var i = 0; i <= numbers.length; i++){ | |
if (numbers[i] > largestNum){ | |
largestNum = numbers[i]; |
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
!!!5 | |
/[if lt IE 7] <html lang="en" class="no-js ie6"> | |
/[if IE 7 ] <html lang="en" class="no-js ie7"> | |
/[if IE 8 ] <html lang="en" class="no-js ie8"> | |
/[if IE 9 ] <html lang="en" class="no-js ie9"> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> | |
%html{lang: 'en'} | |
%head | |
<meta http-equiv="Content-Type" content="text/html" /> |
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
// Define a function max() that takes two numbers as | |
// arguments and returns the largest of them. Use the | |
// if-then-else construct available in Javascript. | |
// https://jsfiddle.net/ryjtyomv/ | |
function max(firstNum, secondNum){ | |
if (firstNum > secondNum) { | |
console.log(firstNum + " is larger than " + secondNum); | |
} 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
// Write a function that takes a character (i.e. a string of length 1) | |
// and returns true if it is a vowel, false otherwise. | |
function isVowel(argument){ | |
var text; | |
var argument = argument.toLowerCase(); | |
var vowels = (['a', 'e', 'i', 'o', 'u']); |
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
// Define a function sum() and a function multiply() that sums and | |
// multiplies (respectively) all the numbers in an array of numbers. | |
// For example, sum([1,2,3,4]) should return 10, and | |
// multiply([1,2,3,4]) should return 24. | |
// https://jsfiddle.net/a7ukhbdn/ | |
// Set addition | |
function sum(numbers) { | |
var total = 0; | |
for (var i = 0; i < numbers.length; i++) { |
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
// Define a function reverse() that computes the reversal of a string. | |
// For example, reverse("jag testar") should return the string "ratset gaj". | |
// https://jsfiddle.net/L678qvLy/ | |
function reverse(str) { | |
var text = ''; | |
for (var i = str.length - 1; i >= 0; i--) { | |
text += str[i]; | |
continue |
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
// Represent a small bilingual lexicon as a Javascript object in | |
// the following fashion {"merry":"god", "christmas":"jul", "and":"och", "happy":gott", "new":"nytt", "year":"år"} | |
// and use it to translate your Christmas cards from English into Swedish. | |
// https://jsfiddle.net/phd824xh/ | |
// Capitalise each word | |
function capitalise(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer