Created
June 13, 2017 04:30
-
-
Save danielnmai/ce265742118bfbb9b44d38bfd5dec8a3 to your computer and use it in GitHub Desktop.
Today I Learned - Week 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------6/12/2017------------ | |
Javascript | |
It can return unexpected results | |
> 5 + "2" => "52" | |
> 5 - "2" => 3 | |
parseInt("342") | |
342.toString() | |
type comparison: 5 === '5' => false (strict) | |
5 == '5' => true (loose) | |
Javascript falseys: | |
false, null, undefined, 0, "", NaN | |
Math.floor() round down the number (10.9 => 10) | |
Math.ceil() round up the number (10.9 => 11) | |
Javascript constructors: similar to Class in Ruby | |
function Car(model, make, year) { | |
this.model = model; | |
this.make = make; | |
this.year = year; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment