Skip to content

Commit

Permalink
simple data manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
kschmit90 committed Sep 2, 2014
1 parent e78ea45 commit 64fea40
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
34 changes: 34 additions & 0 deletions 4-simple-data-manipulation/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Learn what each of the operators (listed below) does,
// then write a program that sets each of two variables to a number,
// then outputs the result of each of these operators on those numbers.
// Make sure you can describe, in your own words, what each operator does.
// +
// -
// /
// *
// %
// ==
// <, >, <=, >=

var numOne = 1
var numTwo = 2

console.log(numOne + numTwo)

console.log(numOne - numTwo)

console.log(numOne / numTwo)

console.log(numOne * numTwo)

console.log(numOne % numTwo)

console.log(numOne == numTwo)

console.log(numOne < numTwo)

console.log(numOne > numTwo)

console.log(numOne <= numTwo)

console.log(numOne >= numTwo)
8 changes: 8 additions & 0 deletions 4-simple-data-manipulation/2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Write a program that sets each of two variables to a number, then displays the integer quotient and integer result to the screen, like so: 7 / 3 = 2 r 1. (Hint: parseInt() in JavaScript is like to_i in Ruby.)

var numOne = 7
var numTwo = 3

console.log(parseInt(numOne / numTwo))

console.log(numOne % numTwo)
5 changes: 5 additions & 0 deletions 4-simple-data-manipulation/3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Write a program that sets a variable to a string, then return the ALLCAPS version of that string. (In Ruby, you would have used upcase.)

var string = "This is a string."

console.log(string.toLocaleUpperCase());
16 changes: 16 additions & 0 deletions 4-simple-data-manipulation/4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Learn how to use the compound assignment operators. What do they do?
// +=
// -=
// *=
// /=
// %=

var num = 1

console.log(num)
console.log(num--)
console.log(num++)
console.log(num += 3)
console.log(num *= 3)
console.log(num /= 3)
console.log(num %= 3)

0 comments on commit 64fea40

Please sign in to comment.