From 4362b9066bb3074e177ab5bef1924956a8528e2d Mon Sep 17 00:00:00 2001 From: Ezra Chiang Date: Sun, 6 Nov 2016 15:29:11 -0800 Subject: [PATCH 1/5] Initial Commit --- scripts.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts.js b/scripts.js index 879a220..392ee83 100755 --- a/scripts.js +++ b/scripts.js @@ -1,3 +1,2 @@ //Use this file to implement Part One of your project - - +var animal = {}; From 3a7cd4fca11fb211f33d0c3751af63ad23626b90 Mon Sep 17 00:00:00 2001 From: Ezra Chiang Date: Sun, 6 Nov 2016 16:08:22 -0800 Subject: [PATCH 2/5] complete objects --- scripts.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts.js b/scripts.js index 392ee83..237b42b 100755 --- a/scripts.js +++ b/scripts.js @@ -1,2 +1,20 @@ //Use this file to implement Part One of your project var animal = {}; + +animal.username = "Mittens"; + +animal['tagline'] = 'Pet me!'; + +var noises = []; + +animal.noises = noises; + +var count = 0; +for (var key in animal) { + count++; + if (key === 'username') { + console.log('hi my name is ' + animal[key]); + } else if (key === 'tagline') { + console.log('I like to say ' + animal[key]); + } +} From ffd097d93497c0e920ea2c28d01e6be43e4fd2fb Mon Sep 17 00:00:00 2001 From: Ezra Chiang Date: Wed, 9 Nov 2016 14:05:57 -0800 Subject: [PATCH 3/5] Arrays --- scripts.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts.js b/scripts.js index 237b42b..7434059 100755 --- a/scripts.js +++ b/scripts.js @@ -18,3 +18,20 @@ for (var key in animal) { console.log('I like to say ' + animal[key]); } } + +//Arrays + +var noiseArray = ['purr', 'oink']; + +noiseArray.unshift('Ezra'); +noiseArray.push('Chiang'); + +noiseArray[3] = 'growl'; + +noiseArray['hello'] = 'GMAN'; + +animal.noises = noiseArray + +var animals = []; + +animals.push(animal); From e25f554a22ebbd5babfc169f17d58387407100f3 Mon Sep 17 00:00:00 2001 From: Ezra Chiang Date: Thu, 10 Nov 2016 13:56:53 -0800 Subject: [PATCH 4/5] Functions --- scripts.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts.js b/scripts.js index 7434059..d6a4f92 100755 --- a/scripts.js +++ b/scripts.js @@ -35,3 +35,20 @@ animal.noises = noiseArray var animals = []; animals.push(animal); + +// functions + +function AnimalTestUser(user) { + var args = arguments.length; + var otherArgs = []; + if (args > 1) { + for (var i=1; i Date: Sat, 12 Nov 2016 14:52:43 -0800 Subject: [PATCH 5/5] higher order functions --- scripts.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts.js b/scripts.js index d6a4f92..8d69a32 100755 --- a/scripts.js +++ b/scripts.js @@ -52,3 +52,5 @@ function AnimalTestUser(user) { otherArgs: otherArgs }; } + +//higher order functions