JavaScript Equality and Type Checks for Pythonistas (Summary)

The Millbrook Valley Weather Co-op’s readings check now runs in JavaScript. readings-check.js prints the same six lines as readings_check.py. It skips the resent ridge reading, rejects school’s, and marks orchard’s failed thermometer as unchanged, because Object.is(NaN, NaN) is true.

Along the way, you’ve learned to:

  • Compare records by the fields that identify them
  • Explain why primitives compare by value and how strings and numbers still get methods
  • Pair typeof with the checks it can’t make
  • Check an object’s class with instanceof, and negate the check safely
  • Read == by its rules, and replace it safely
  • Choose between === and Object.is()

Each of these came from a Python habit that needed a second look.

Keep and Drop Your Python Habits

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.