Coder Social home page Coder Social logo

one-to-ten's Introduction

** Functions, Data types and Conditionals OH MAI

** Complete all exercises

Create ALL THE THINGS! // create the following variables // hero with a string value // gender with a string value // age with a number value // weapon with a string value // pronoun with an empty value

// Create a conditional that sets the pronoun variable depending on the gender

// Create a conditional that out puts "is just beginning" if age is less than 18. // If their age is between 21 and 40 out put "has seen a few battles" // If their age is greater than 40 out put "has lived through many epic battles"

// Create the following sentece using your newly created variables: // "[Jake] is our lovable hero, who [has seen a few battles] with his trusty [sword]."

1 Fish 2 Fish // create a variable named count with no value // create a variable named animal and set the variable to any animal as a string // create a function name animalHouse that takes two parameters // set the count variable to equal the sum of the two parameters // console.log the count variable // invoke animalHouse

1 Fish 2 Many Fish (cont.) // create a conditional that checks the count variable // check if the count is greater than 2 // console.log 'We have to many elephants' where the animal is the animal variable and an 's' added to the animal. // if the first condition is false console.log 'Welcome to the club'

Assemble the Avengers // create a variable named hero and set the value to any avenger as a string

// create a function named avengersAssemble that takes one parameter avenger // inside the function create a conditional to check the parameter. // console.log and concat the parameter with a different message based on which avenger assembles if the condition is true // create four conditions, one for ironman, captain america, black widow and a default to console.log('Sorry, you are not needed for this mission')

// example: if the avenger is Hulk -- console.log(avenger + 'smash'); // invoke avengersAssemble and pass the variable hero

Lights Out // create a variable named lights and set the value to a boolean // create a conditional // if the variable is true console.log('And then there was light') // else console.log('Lights out')

Vroom Vroom // create a variable named carType and set the value to Toyota, Lamborghini, or Tesla as a string. // create a variable named color and set the value to red, blue, or black as a string // create a variable named num and set the value to an integer

//create a conditional and check for the following: // check for a blue Toyota // check for a red Lamborghini // check for a black Tesla //console log "We have" and your variables. for each condition. // if none of the conditions are true console log this sentence with your variables,"We don't have any blue Toyotas in stock"

one-to-ten's People

Contributors

khasperbali 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.