Code Monkey home page Code Monkey logo

js-course-challanges's Introduction

Variables #1

  1. create "firstName" and "last_name" variables
  2. assign your values
  3. create "address" variable and assign "main street" value to it
  4. re-assign address to "first street" later
  5. log all values in the console

Concatenate Strings #2

  1. create "street" and "country" variables
  2. assign your values
  3. create "fullMailingAddress" variable and assign the result of "street + country"
  4. remember about the space
  5. log "fullMailingAddress" in the console

Numbers #3

  1. create "score1", "score2", "score3" variables and assign values (0-100)
  2. calculate total score and average score, and assign them to the variables.
  3. log total score and average score
  4. create "plates" variable and assign 20
  5. create "people" variable and assign 7
  6. calculate remaining plates and assign to the variable
  7. add one to remaining plates
  8. create message variable and display 'There are (your value goes here) plates available' - string concatenation
  9. log message

Arrays #4

  1. create "fruits" array and store some fruit values
  2. setup the last item as number (random)
  3. assign first fruit to the variable
  4. re-assign last array item to the actual fruit
  5. log both first fruit variable and entire fruits array

Functions #5

  1. create "calculateTotal" function
  2. add two parameters subTotal, tax
  3. return sum of parameters
  4. create 3 vars "order1","order2","order3"
  5. call calculateResult, pass in some values and assign result to each order
  6. log all three orders
  7. refactor "calculateTotal" to function expression

Objects #6

  1. create car object
  2. add make, model, year, colors (array), hybrid (boolean) keys
  3. add two methods (drive and stop)
  4. in the function body setup log with random text
  5. log make
  6. log first color
  7. invoke both methods

Conditional Statements #7

  1. create two objects "person1", "person2"

  2. setup name,age (15-25), status ('resident', 'tourist') keys

  3. setup if else, condition where age must be bigger than 18 and status must be equal to 'resident'

  4. test with both objects

Strings #8

  1. create function fullName
  2. accept two parameters "firstName", "lastName"
  3. add them together (concat) and return result in uppercase
  4. invoke fullName and pass some values
  5. log result
  6. change the order of arguments
  7. refactor to object parameter

Array Methods #9

Multiple Videos

Create Students Array

  1. setup students array with 5 students { id: 1, name: 'peter', score: 80, favoriteSubject: 'math', },

Use Multiple Files

  • easer to manage code base (file, project)
  • order matters
  • other ways to achieve the same result (ES6 modules, fetch DB )
  • not limited to just static data

updatedStudents

  1. add role:'student' property to each object using MAP method
  2. assign to 'updatedStudents' variable and log

highScores

  1. filter array and return only scores >= 80
  2. assign to 'highScores' variable and log

specificId

  1. find specific id in array
  2. assign to 'specificId' variable and log

averageScore

  1. sum up all student.score values with reduce
  2. divide by the length of the students array
  3. assign to 'averageScore' and log

survey

  1. list favorite subjects with reduce { english: 1 history: 1 math: 3 }
  2. assign to survey and log

js-course-challanges's People

Contributors

john-smilga avatar l-a-r-i-x 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.