Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added week 2 assignment
  • Loading branch information
maa17019 committed Jan 31, 2021
1 parent 138c9e5 commit 891c733
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 20 deletions.
Binary file modified week-2/.DS_Store
Binary file not shown.
201 changes: 201 additions & 0 deletions week-2/jsforcats_mahnoor.log
@@ -0,0 +1,201 @@
"I love dogs"
"I love dogs"
"Dogs are adorable"
"Dogs are adorable"
var dogSentence = "dogs are the bane of my existence"
undefined
dogSentence
"dogs are the bane of my existence"
dogSentence.replace('dogs', 'those blasted dogs');
"those blasted dogs are the bane of my existence"
dogSentence
function makeMoreExciting(string) {
return string + '!!!!'
}
undefined
var string = "hello yes this is a cat";
undefined
string + "!!!!"
"hello yes this is a cat!!!!"
string
"hello yes this is a cat"
function makeMoreExciting(string) {
return string + '!!!!'
}
undefined
makeMoreExciting('lounging')
"lounging!!!!"
makeMoreExciting()
"undefined!!!!"
makeMoreExciting("I am cool")
"I am cool!!!!"
var sentence = "time for a nap"
undefined
makeMoreExciting(sentence)
"time for a nap!!!!"
sentence
"time for a nap"
sentence + "!!!!"
"time for a nap!!!!"
function makeMoreExciting(string) {
string + '!!!!'
}
undefined
var sentence = "time for a nap"
undefined
function yellIt(string) {
string = string.toUpperCase()
string = makeMoreExciting(string)
console.log(string)
}
undefined
var sentence = "i fear no human"
undefined
yellIt(sentence);
VM999:4 undefined
undefined
yellIt(sentence)
VM999:4 undefined
undefined
function yellIt(string) {
string = string.toUpperCase()
string = makeMoreExciting(string)
console.log(string)
}
undefined
var sentence = "i fear no human"
undefined
yellIt(sentence)
VM1168:4 undefined
undefined
function yellIt(string) {
string = string.toUpperCase()
return makeMoreExciting(string)
}
undefined
console.log(yellIt("i fear no human"))
VM1318:1 undefined
undefined
function yellIt(string) {
string = string.toUpperCase()
return makeMoreExciting(string)
}

console.log(yellIt("i fear no human"))

VM1324:6 undefined
undefined
function logANumber(someNumber) {
console.log(someNumber)
}
_.times(10, logANumber)
VM1330:4 Uncaught ReferenceError: _ is not defined
at <anonymous>:4:1
(anonymous) @ VM1330:4
logANumber(0)
logANumber(1)
logANumber(2)
logANumber(3)
logANumber(4)
logANumber(5)
logANumber(6)
logANumber(7)
logANumber(8)
logANumber(9)
VM1330:2 0
VM1330:2 1
VM1330:2 2
VM1330:2 3
VM1330:2 4
VM1330:2 5
VM1330:2 6
VM1330:2 7
VM1330:2 8
VM1330:2 9
undefined
var zeroThroughTen = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
undefined
var myCatFriends = ["bill", "tabby", "ceiling"]
undefined
console.log(myCatFriends[0])
VM1590:1 bill
undefined
myCatFriends.push("super hip cat")
4
myCatFriends
(4) ["bill", "tabby", "ceiling", "super hip cat"]0: "bill"1: "tabby"2: "ceiling"3: "super hip cat"length: 4__proto__: Array(0)
myCatFriends.length
4
var myCatFriends = ["bill", "tabby", "ceiling"]
var lastNames = ["the cat", "cat", "cat"]
var addresses = ["The Alley", "Grandmas House", "Attic"]
undefined
var billsPosition = 0;
undefined
myCatFriends[billsPosition];
"bill"
address[billsPosition];
VM1870:1 Uncaught ReferenceError: address is not defined
at <anonymous>:1:1
(anonymous) @ VM1870:1
addresses[billsPosition]
"The Alley"
var firstCat = { name: "bill", lastName: "the cat", address: "The Alley" }
var secondCat = { name: "tabby", lastName: "cat", address: "Grandmas House" }
var thirdCat = { name: "ceiling", lastName: "cat", address: "Attic" }
undefined
console.log(firstCat.name)
VM2013:1 bill
undefined
console.log(firstCat.name, firstCat.address)
VM2201:1 bill The Alley
undefined
{ date: "10/20/2012", diary: "slept a bit today", name: "Charles" }
{date: "10/20/2012", diary: "slept a bit today", name: "Charles"}
console.log(date)
VM2264:1 Uncaught ReferenceError: date is not defined
at <anonymous>:1:13
(anonymous) @ VM2264:1
//array filled with objects
var moodLog = [
{
date: "10/20/2012",
mood: "catnipped"
},
{
date: "10/21/2012",
mood: "nonplussed"
},
{
date: "10/22/2012",
mood: "purring"
}
]
undefined
//object filled with array
// ordered from least to most favorite
var favorites = {
treats: ["bird sighting", "belly rub", "catnip"],
napSpots: ["couch", "planter box", "human face"]
}
undefined
function measureLoopSpeed() {
var count = 0
function addOne() { count = count + 1 }

// Date.now() returns a big number representing the number of
// milliseconds that have elapsed since Jan 01 1970
var now = Date.now()

// Loop until Date.now() is 1000 milliseconds (1 second) or more into
// the future from when we started looping. On each loop, call addOne
while (Date.now() - now < 1000) addOne()

// Finally it has been >= 1000ms, so let's print out our total count
console.log(count)
}

measureLoopSpeed()
VM2384:14 8252046
undefined
VM37:55 Uncaught SyntaxError: Unexpected identifier
20 changes: 0 additions & 20 deletions week-2/week-2.log

This file was deleted.

0 comments on commit 891c733

Please sign in to comment.