Skip to content

Instantly share code, notes, and snippets.

@clytemnestra
Forked from sergiulucutar/Homework.md
Last active October 30, 2019 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clytemnestra/a654b4068a3133c3ecbc1e6f901a01d3 to your computer and use it in GitHub Desktop.
Save clytemnestra/a654b4068a3133c3ecbc1e6f901a01d3 to your computer and use it in GitHub Desktop.
Intro in JavaScript, Homework 1
  1. What is the result of the following statements? Why?
!!0 == '0'
!0 -> true
!!0->false
false == '0' => true

3 + '4'
34

2 * 7 / 0
x/0 = infinity

var pers = {
  name: 'John',
  age: 34
}
pers.name - John

pers['age'] - 34
  1. What does this program do?
const result = prompt("What language are we learning?");
if(result === "javascript"){
  console.log("You're right!");
}
else{
  console.log("No!");
}

prompts for 'javascript' and prints a message according to the input

  1. Modify the program form exercise 2 so it will ask until you get the right answer?
var result;
do {
  result = prompt("What language are we learning?");
}
while (result !== "javascript");
  1. Given a number, write a program that will log the Fibonacci sequence until it reaches the given number.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment