🤑 Join the Treehouse affiliate program and earn 25% recurring commission!

New No-Code Track! 🚀start learning today!

🌟 Dreaming of a bright future? 🎓 Ask about the Treehouse Scholarship program! 🚀

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

  • Treehouse Logo
  • Plans
    Chevron
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
  • Library
    Chevron
    • All Courses
    • Tracks
    • College Credit
  • Techdegree
    Chevron
    • Overview
    • Front End Development
    • Full Stack JavaScript
    • Data Analysis
    • UX Design
    • Python
  • Community
    Chevron
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
  • Resources
    Chevron
    • Career Toolbox
    • CodeForward
    • Free Treehouse Near Me
    • Jobs
    • Blog
    • Support
    • About
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks College Credit
  • Overview Front End Web Development Full Stack JavaScript Python Development Data Analysis UX Design
  • Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Career Toolbox CodeForward Free Treehouse Near Me Jobs Blog Support About
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • Android
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
  • Deloris Luckett
    Deloris Luckett
    6,418 Points

    The subtraction function in subtraction.js throws an error if it's called with anything other than numbers. Write a spec

    Posted December 23, 2020 7:46pm by Deloris Luckett
    Deloris Luckett
    6,418 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Georg Ekeberg
    Georg Ekeberg
    5,702 Points

    Unable to find the right solution by testing for an error thrown

    Posted July 15, 2020 1:31pm by Georg Ekeberg
    Georg Ekeberg
    5,702 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Eden Gomez
    Eden Gomez
    22,787 Points

    Can somebody please give me a hint with what method should I use for this challenge?

    Posted July 14, 2019 5:23pm by Eden Gomez
    Eden Gomez
    22,787 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    0 Answers

  • Aaron Bell
    Aaron Bell
    6,113 Points

    How does this spec not check for subtraction's desired behavior?

    Posted May 21, 2019 4:44pm by Aaron Bell
    Aaron Bell
    6,113 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    5 Answers

  • Roland Abregorivas
    Roland Abregorivas
    16,784 Points

    Dont understand the question regarding subtraction Spec. Can someone explain what they are looking for.

    Posted December 31, 2018 12:21am by Roland Abregorivas
    Roland Abregorivas
    16,784 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    0 Answers

  • liamthornback2
    liamthornback2
    9,618 Points

    "Bummer: We tried your spec with a version of subtraction.js that DOESN'T work correctly, expecting the test to fail..."

    Posted December 3, 2018 4:56pm by liamthornback2
    liamthornback2
    9,618 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    2 Answers

  • Ivan Sardelić
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Ivan Sardelić
    Full Stack JavaScript Techdegree Graduate 18,248 Points

    I don't see what I'm missing here :/

    Posted October 17, 2018 3:28pm by Ivan Sardelić
    .a{fill-rule:evenodd;}techdegree seal-36
    Ivan Sardelić
    Full Stack JavaScript Techdegree Graduate 18,248 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Vitaly Kashubin
    Vitaly Kashubin
    8,449 Points

    Can't find a fault! Could you please help me?

    Posted August 31, 2018 3:19pm by Vitaly Kashubin
    Vitaly Kashubin
    8,449 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Kaitlyn Dodds
    Kaitlyn Dodds
    32,545 Points

    Can't figure out why my solution doesn't pass.

    Posted August 22, 2018 7:55pm by Kaitlyn Dodds
    Kaitlyn Dodds
    32,545 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    3 Answers

  • Alex Rogers
    Alex Rogers
    9,844 Points

    Yet another chai docs question (throwing an error)

    Posted May 30, 2018 3:48pm by Alex Rogers
    Alex Rogers
    9,844 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    0 Answers

  • Mohammed Ali
    Mohammed Ali
    10,625 Points

    Struggling with Javascript Unit Testing 'Code Challenge: Catching an Error'

    Posted March 18, 2018 1:07pm by Mohammed Ali
    Mohammed Ali
    10,625 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    3 Answers

  • nico dev
    nico dev
    20,364 Points

    Why is a callback and a variable assignment needed here, instead of testing the function straightaway?

    Posted September 29, 2017 5:25am by nico dev
    nico dev
    20,364 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Santiago Cabrera
    Santiago Cabrera
    11,087 Points

    Don't understand why it doesn't work

    Posted April 1, 2017 5:07am by Santiago Cabrera
    Santiago Cabrera
    11,087 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Harold Stewart
    Harold Stewart
    9,322 Points

    Javascript unit testing challenge

    Posted March 3, 2017 5:59pm by Harold Stewart
    Harold Stewart
    9,322 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    2 Answers

  • adammccann
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    adammccann
    Python Web Development Techdegree Student 12,554 Points

    expect(subtraction("a","b")).to.throw('subtraction only works with numbers!') How could this not work?

    Posted February 26, 2017 5:20am by adammccann
    .a{fill-rule:evenodd;}techdegree
    adammccann
    Python Web Development Techdegree Student 12,554 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Christopher Lebbano
    Christopher Lebbano
    15,338 Points

    Test spec, not sure why this isn't working

    Posted February 21, 2017 6:41pm by Christopher Lebbano
    Christopher Lebbano
    15,338 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Ioannis Leontiadis
    Ioannis Leontiadis
    9,828 Points

    Catching an Error?

    Posted December 10, 2016 10:23pm by Ioannis Leontiadis
    Ioannis Leontiadis
    9,828 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Fábio Nascimento
    Fábio Nascimento
    10,418 Points

    What is wrong with my code?

    Posted July 19, 2016 12:57pm by Fábio Nascimento
    Fábio Nascimento
    10,418 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Alejandro Molina
    Alejandro Molina
    3,997 Points

    Stuck on code challenge

    Posted May 31, 2016 9:48pm by Alejandro Molina
    Alejandro Molina
    3,997 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Faddah Wolf
    Faddah Wolf
    12,811 Points

    put in correct answer, works in my code editor, does not work in test for JavaScript Unit Testing

    Posted May 13, 2016 6:27am by Faddah Wolf
    Faddah Wolf
    12,811 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    1 Answer

  • Nikola Brežnjak
    Nikola Brežnjak
    10,897 Points

    The subtraction function in subtraction.js throws an error if it's called with anything other than numbers.

    Posted May 10, 2016 6:40am by Nikola Brežnjak
    Nikola Brežnjak
    10,897 Points
    • JavaScript
    • JavaScript Unit Testing
    • Improving Our Tests
    • Catching an Error

    3 Answers

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

    Treehouse

  • About
  • Blog
  • Careers
  • Community
  • Stories
  • Shop
  • Contact
  • Gift Card

See Full Catalogue

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
  • Python Development
  • Data Analysis
  • UX Design

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
  • ...see more

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
  • ...see more

Explore

  • Plans
  • Affiliates
  • Perks
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
Terms & Conditions | Privacy

© 2025 Treehouse Island, Inc.