Code Monkey home page Code Monkey logo

h1-w01d05-javascript-reps's Introduction

Homework - JS Practice and Project HTML/CSS Draft

This gif is completely irrelevant to the hw tonight, but might be relatable for some other things this week!

anyways!

This homework has two parts! The first part is practicing the javascript skills we learned today. The second part is to work on projects!

Part 1 - Javascript Practice

For this assignment, complete the problems below and add your solutions to this README.md.

1 - Activity Assignment

*Without running the following code

*, try to determine:

var a = 1;
var b = 'bongos';
var c = true;

a = b;
b = c;
c = a;


### Your solution here:
1.  What is `a`?

a is ('bongos')

2.  What is `b`?

b is (true)

3.  What is `c`?

c is (1)


Now run it and don't update your answers above.  Any surprises?  Don't worry about submitting wrong answers, it's all good :3

For the next problems, feel free to test out solutions in repl.it before putting your solutions in this readme!

## 2 - Activity Concatenation
Use the `+` operator to concatenate these strings together within a `console.log()`: "Please", "squeeze", "the", "cheese". __Make sure there are spaces in-between each word__.

```js
var firstWord = "Please";
var secondWord = "squeeze";
var thirdWord = "the";
var fourthWord = "cheese";

Result should be: "Please squeeze the cheese" console.log("Please " + squeeze + " the" + "cheese");

3 - Variable Assignments

Output a console log The sum of 5 and 10 is 15 where the values for 5 and 10 are saved to variables, and where 15 comes from those variables being summed.

var num1 = 5; var num2 = 10;

Let's do this in parts:

  1. How can we make num3 equal to the sum of num1 and num2?

    num1 = "5" num2 = "10" num3 = num1+num2 15

  2. Use variables num1, num2 and num3 to fill in the console.log() to complete the sentence:

The sum of 5 and 10 is 15

console.log(num3[5]+[10]);

4 - Comparisons

By just looking at the following expressions, determine in your mind whether or not each will evaluate to true or false

a) 999 > 999
b) 999 === 999 
c) 999 !== 999
d) -5 >= -4
e) 100 <= -100
f) 20 + 5 < 5 
g) 81 / 9 === 9
h) 9 !== 8 + 1

Your solution here:

Write true or false based on the list above

a) false
b) true
c) false
d) true
e) false
f) false
g) false
h) false

5 - Functions:

  • Write a function called timeTwo that takes in a parameter num and return's that number multiplied by 2.

function timeTwo(a, b) return a2, b2;

6 - Loops:

  • Write a for loop so that the function outputs all values between 0 and any number passed into the maxNum parameter. for (var i = 0; i < 10; i++){ console.log(i); //outputs 0,1,2,3,4,5,6,7,8,9 }

7 - Arrays:

  • Create a variable favoriteMovies that is equal to an array of your 5 favorite movies:

var favoriteMovies = [‘Home Alone’, ‘pocahontas’, ‘Big Momma's Housw’, ‘Frozen’, ‘jumanji’ ];

  • How would you replace the 3rd favorite movie with the value Toy Story 3?

favoriteMovies [2] = "Toy Story 3";

  • How would you remove the last movie from that array?

favoriteMovies.pop();

  • Write a function called addMovie that takes a parameter of newMovie that adds that movie to the end of the array. addMovie('Titanic')) adds Titanic to the end of the array.

var addMovie = [[‘Home Alone’, ‘pocahontas’,'Titanic'] [‘Big Momma's Hous’, ‘Frozen’, ‘jumanji’]; newMovie[0][2] //=> 'Titanic'

newMovie[2].push('Titanic'); console.log(newMovie);

Part 2: Project Progress: HTML and CSS!

Let's keep trucking along with our projects! Our next project milestone is to have the a draft of the HTML/CSS. Your draft should be focused on the structure of your application, like placement of the headers, the main content, the nav, footer, etc. You should have a little bit of the text/content ready to go, but making sure you have a good layout is far more important at this point.

We are going to start looking at your project proposals tonight and will have all proposals addressed by tomorrow (Friday, April 12th) at noon!

To start your projects:

  • Make a new folder on your computer called "Final Project"
  • In that folder create files called index.html, style.css and main.js
  • Do all if your work in the new index.html and style.css files.

Due Dates and Times:

Your javascript exercises are due at midnight Saturday night!

Your project progress is due Sunday morning in class! We'll do submissions together that morning.

h1-w01d05-javascript-reps's People

Contributors

trevorpreston avatar reemabdulaziz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.