Explorar o código

Finish booleans

Signed-off-by: Michael Tang <michael.h.tang@gmail.com>
Michael Tang %!s(int64=5) %!d(string=hai) anos
achega
2947530d29
Modificáronse 6 ficheiros con 58 adicións e 0 borrados
  1. 26 0
      boolean.js
  2. 1 0
      hello-world.js
  3. 17 0
      numbers.js
  4. 4 0
      strings.js
  5. 5 0
      temp-conversion.js
  6. 5 0
      variables.js

+ 26 - 0
boolean.js

@@ -0,0 +1,26 @@
+// === - equiality operator
+// !== - not equal operator
+// <   - less than
+// >   - greater than
+// <=  - less than or equl to
+// >=  - greater than or equal to
+
+let temp = 31
+let isFreezing = temp < 32
+
+console.log(isFreezing)
+
+//Challenge area
+
+// Create age set to your age
+// Calculate is child  - if they are 7 or under
+// Calculate is senore - if they are 65 or older
+// Print is child value
+// Print is senior value
+
+let age = 7
+let isChild = age <= 65
+let isSenior = age >= 65
+
+console.log('isChild: ' + isChild )
+console.log('isSenior: ' + isSenior)

+ 1 - 0
hello-world.js

@@ -0,0 +1 @@
+console.log('Hello world')

+ 17 - 0
numbers.js

@@ -0,0 +1,17 @@
+let age = 26
+let dogYears = (age + 1) / 7
+
+console.log(dogYears)
+
+// Challenge area
+
+// studentScore
+// maxScore
+// percent
+
+//print the percent
+let studentScore = 18
+let maxScore = 20
+let percent = (18/20) * 100
+
+console.log(percent + "%")

+ 4 - 0
strings.js

@@ -0,0 +1,4 @@
+let city = 'London'
+let country = 'United Kingdom'
+let location = city + ', ' + country
+console.log(location)

+ 5 - 0
temp-conversion.js

@@ -0,0 +1,5 @@
+let fahrenheit = -50
+let celcius = (fahrenheit - 32) * (5/9)
+console.log(celcius + 'C')
+let kelvin = (fahrenheit + 459.67) * (5/9)
+console.log(kelvin + 'K')

+ 5 - 0
variables.js

@@ -0,0 +1,5 @@
+let petName = 'Maple'
+petName = 'Spot'
+
+console.log(petName)
+