Compare and Convert

Martin Breuss 24 Lessons 5h 33m Updated basics js

Numbers often arrive as text, and a rule like “at most 8 kg” needs a precise yes-or-no answer. In this course, you’ll write JavaScript that turns numeric text into numbers you can calculate with, answers comparison questions, and keeps those numbers apart from the text you show.

In this course, you’ll learn how to:

  • Store Boolean values, and tell true apart from the text "true"
  • Compare numbers and text with <, >, <=, and >=, and decide whether a boundary counts
  • Check whether two values match with === and !==
  • Convert numeric text with Number() and spot a failed conversion with Number.isNaN()
  • Tell null and undefined apart from real values such as 0 and empty text
  • Round with Math methods, and format with toFixed() only when you show a result

Along the way, you’ll practice in exercises with tests and print a short journey report from your own script. Then you’ll build the calculation core of an adventure-pack checker on RealJS. It totals gear weights given as text, checks the total against a weight limit, and produces a line of display text.

This course builds on Values, Names, and Text. You should be able to use variables, arithmetic, strings, and template literals, and run scripts with Node in VS Code.

What’s Included:

  • 24 Lessons
  • Video Subtitles and Full Transcripts
  • Translated Subtitles in 8 Languages
  • 2 Downloadable Resources
  • Interactive Quiz to Check Your Progress
  • 9 Hands-On Coding Exercises
  • Q&A With JavaScript Experts: Ask a Question
  • Certificate of Completion

Downloadable Resources:

Related Learning Paths:

About Martin Breuss

Martin is Head of Content Strategy at RealJS. He came to programming from biology and has been teaching programming for more than ten years, as a coding mentor, code reviewer, curriculum developer, bootcamp instructor, and instructional designer.

» More about Martin

← Browse All Courses