Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Comparing and Converting JavaScript Values

via CodeSignal

Overview

Values come in different kinds, and programs go wrong when the kinds get mixed up by accident. Here you'll check what kind of value you are holding, convert deliberately between text and numbers, compare two values to get a true-or-false answer, and combine several of those answers into one condition.

Syllabus

Checking a Value's Kind with typeof

  • Check a Number and a Piece of Text
  • Check a Stored Value
  • Text That Looks Like a Number
  • Label All Three Types

Converting Between Text and Numbers

  • See the Plus Sign Trap
  • Convert Text to a Number
  • Convert a Number to Text
  • Repair a Wrong Total

Comparing Values with === and Other Operators

  • Compare Two Numbers
  • Store a Comparison
  • Check Equality Strictly
  • Write a Stock Report

Combining Conditions with &&, ||, and !

  • Both Must Be True
  • Either Will Do
  • Flip an Answer
  • Decide Whether the Shop Can Serve

Reviews

Start your review of Comparing and Converting JavaScript Values

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.