This file contains hidden or 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> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> | |
<meta charset="utf-8"> | |
<title>Card Demo</title> | |
<style id="jsbin-css"> | |
my-card { | |
display: block; |
This file contains hidden or 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
// 1 - Create a class for for a Vehicle. Each vehicle should have a make, model and year property. | |
// 2 - Add an instance method called start which returns the string "VROOM!" | |
// 3 - Add an instance method called toString which returns the string "The make, model, and year are" concatenated with the make, model and year property | |
/* Examples | |
var vehicle = new Vehicle("Tractor", "John Deere", 1999) | |
vehicle.toString() // 'The make, model, and year are Tractor John Deere 1999' | |
*/ |
This file contains hidden or 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
count = 0; | |
class Person { | |
constructor(firstName, lastName, favoriteColor, favoriteNumber) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.favoriteColor = favoriteColor; | |
this.favoriteNumber = favoriteNumber; | |
} |
This file contains hidden or 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 called arrayFrom which converts an array-like-object into an array. | |
Examples: | |
var divs = document.getElementsByTagName('divs'); | |
divs.reduce // undefined | |
var converted = arrayFrom(divs); | |
converted.reduce // function(){}.... | |
*/ |
This file contains hidden or 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 called specialMultiply which accepts two parameters. If the function is passed both parameters, it should return the product of the two. If the function is only passed one parameter - it should return a function which can later be passed another parameter to return the product. You will have to use closure and arguments to solve this. | |
Examples: | |
specialMultiply(3,4); // 12 | |
specialMultiply(3)(4); // 12 | |
specialMultiply(3); // function(){}.... | |
*/ |
This file contains hidden or 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 called hasOddNumber which accepts an array and returns true if the array contains at least one odd number, otherwise it returns false. | |
Examples: | |
hasOddNumber([1,2,2,2,2,2,4]) // true | |
hasOddNumber([2,2,2,2,2,4]) // false | |
*/ | |
function hasOddNumber(arr){ | |
return arr.some(function(val) { |
This file contains hidden or 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 called doubleValues which accepts an array and returns a new array with all the values in the array passed to the function doubled | |
Examples: | |
doubleValues([1,2,3]) // [2,4,6] | |
doubleValues([1,-2,-3]) // [2,-4,-6] | |
*/ | |
function doubleValues(arr){ | |
return arr.map(function(val, i, arr) { |
This file contains hidden or 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 called doubleValues which accepts an array and returns a new array with all the values in the array passed to the function doubled | |
Examples: | |
doubleValues([1,2,3]) // [2,4,6] | |
doubleValues([5,1,2,3,10]) // [10,2,4,6,20] | |
*/ | |
function doubleValues(arr){ | |
const newArr = []; |
This file contains hidden or 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 called doubleValues which accepts an array and returns a new array with all the values in the array passed to the function doubled | |
Examples: | |
doubleValues([1,2,3]) // [2,4,6] | |
doubleValues([5,1,2,3,10]) // [10,2,4,6,20] | |
*/ | |
function doubleValues(arr){ | |
const newArr = []; |
This file contains hidden or 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
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.6.2/jasmine.css"> | |
</head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.6.2/jasmine.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.6.2/jasmine-html.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.6.2/boot.js"></script> |