From d90453c345b0d3e9f7b8be7c9d7a69c249aa0ab7 Mon Sep 17 00:00:00 2001 From: Kaleb Davis Date: Tue, 9 Jun 2015 11:08:05 -0400 Subject: [PATCH] source files for js101 --- .DS_Store | Bin 0 -> 6148 bytes accessing-array-values.js | 2 ++ array-filtering.js | 5 +++++ arrays.js | 2 ++ for-loop.js | 6 ++++++ function-arguments.js | 5 +++++ functions.js | 4 ++++ if-statement.js | 7 +++++++ introduction.js | 1 + looping-through-arrays.js | 5 +++++ number-to-string.js | 2 ++ numbers.js | 2 ++ object-properties.js | 4 ++++ objects.js | 6 ++++++ revising-strings.js | 3 +++ rounding-numbers.js | 3 +++ scope.js | 16 ++++++++++++++++ string-length.js | 2 ++ strings.js | 2 ++ variables.js | 2 ++ 20 files changed, 79 insertions(+) create mode 100644 .DS_Store create mode 100644 accessing-array-values.js create mode 100644 array-filtering.js create mode 100644 arrays.js create mode 100644 for-loop.js create mode 100644 function-arguments.js create mode 100644 functions.js create mode 100644 if-statement.js create mode 100644 introduction.js create mode 100644 looping-through-arrays.js create mode 100644 number-to-string.js create mode 100644 numbers.js create mode 100644 object-properties.js create mode 100644 objects.js create mode 100644 revising-strings.js create mode 100644 rounding-numbers.js create mode 100644 scope.js create mode 100644 string-length.js create mode 100644 strings.js create mode 100644 variables.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ce13e2cdc783f564f708eba17c3cf75f352ebaae GIT binary patch literal 6148 zcmeHKF-`+P474Fd5KT(TEvb 5){ + console.log("The fruit name has more than five characters."); +} +else { + console.log("The fruit name has five characters or less."); +} diff --git a/introduction.js b/introduction.js new file mode 100644 index 0000000..702f428 --- /dev/null +++ b/introduction.js @@ -0,0 +1 @@ +console.log("hello"); diff --git a/looping-through-arrays.js b/looping-through-arrays.js new file mode 100644 index 0000000..5e93fda --- /dev/null +++ b/looping-through-arrays.js @@ -0,0 +1,5 @@ +var pets = ['cat', 'dog', 'rat']; +for(var i = 0; i < pets.length; i++){ + pets[i] = pets[i] + 's'; +} +console.log(pets); diff --git a/number-to-string.js b/number-to-string.js new file mode 100644 index 0000000..7c751c8 --- /dev/null +++ b/number-to-string.js @@ -0,0 +1,2 @@ +var n = 128; +console.log(n.toString()); diff --git a/numbers.js b/numbers.js new file mode 100644 index 0000000..574fcc9 --- /dev/null +++ b/numbers.js @@ -0,0 +1,2 @@ +var example = 123456789; +console.log(example); diff --git a/object-properties.js b/object-properties.js new file mode 100644 index 0000000..5047b74 --- /dev/null +++ b/object-properties.js @@ -0,0 +1,4 @@ +var food = { + types: 'only pizza' +}; +console.log(food.types); diff --git a/objects.js b/objects.js new file mode 100644 index 0000000..c77fdb4 --- /dev/null +++ b/objects.js @@ -0,0 +1,6 @@ +var pizza = { + toppings: ['cheese', 'sauce', 'pepperoni'], + crust: 'deep dish', + serves: 2 +} +console.log(pizza); diff --git a/revising-strings.js b/revising-strings.js new file mode 100644 index 0000000..37d5f72 --- /dev/null +++ b/revising-strings.js @@ -0,0 +1,3 @@ +var pizza = 'pizza is alright'; +pizza = pizza.replace('alright', 'wonderful'); +console.log(pizza); diff --git a/rounding-numbers.js b/rounding-numbers.js new file mode 100644 index 0000000..6498203 --- /dev/null +++ b/rounding-numbers.js @@ -0,0 +1,3 @@ +var roundUp = 1.5; +var rounded = Math.round(roundUp); +console.log(rounded); diff --git a/scope.js b/scope.js new file mode 100644 index 0000000..a54e6bf --- /dev/null +++ b/scope.js @@ -0,0 +1,16 @@ +var a = 1, b = 2, c = 3; + +(function firstFunction() { + var b = 5, c = 6; + (function secondFunction(){ + var b = 8; + console.log("a: "+a+", b: "+b+",c: "+c); + (function thirdFunction(){ + var a = 7, c = 9; + (function fourthFunction(){ + var a = 1, c = 8; + })(); + })(); + })(); +})(); + diff --git a/string-length.js b/string-length.js new file mode 100644 index 0000000..88992c9 --- /dev/null +++ b/string-length.js @@ -0,0 +1,2 @@ +var example = 'example string'; +console.log(example.length); diff --git a/strings.js b/strings.js new file mode 100644 index 0000000..7ede3d3 --- /dev/null +++ b/strings.js @@ -0,0 +1,2 @@ +var someString = 'this is a string'; +console.log(someString); diff --git a/variables.js b/variables.js new file mode 100644 index 0000000..db67935 --- /dev/null +++ b/variables.js @@ -0,0 +1,2 @@ +var example = "some string"; +console.log(example);