Giter VIP home page Giter VIP logo

w02d01-hw-array-conditions's Introduction

JavaScript conditions and loops HWs

For loop

Numbers' summations

  • Loop though this array let Numbers = [23,54,32,87,47] and print the sum of all numbers

Maximum number

  • Create an array of the following numbers [16,4,2,0,19,6]
  • Loop through the array elements and print the maximum number of this list to the console.

Reverse Array

  • Create an array of the following numbers [1,2,3,4,5,6,7,8,9,10]
  • print the array in a reverse order

Nested for loop

stars pattern

  • Declare a variable and assign a number to it.
  • Print a right angle triangle using stars to the console. Example: if the variable is 5, the printed pattern will be as follow:

*
**
***
****
*****

While loop

  • Create an array of the following numbers [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
  • Loop through this array and print the prime numbers.

Note: A number is prime if it is divided by 1 and itself only.

Arrays

MAP

  1. Get array of objects with just name and height properties
  2. Get array of all first names

REDUCE

  1. Get total mass of all characters
  2. Get total number of characters in all the character names

FILTER

  1. Get characters with mass greater than 100
  2. Get all female characters

SORT

  1. Sort by name
  2. Sort by gender

EVERY

  1. Does every character have blue eyes?
  2. Is every character male?

SOME

  1. Is there at least one male character?
  2. Is there at least one character that has mass less than 50?

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.