freeCodeCamp/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.english.md
Hassaan Pasha 80438cac3e
feat(client, learn): add helper functions for common validation operations (#38605)
Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
2020-09-17 19:38:01 +05:30

1.1 KiB

id, title, challengeType, videoUrl, forumTopicId
id title challengeType videoUrl forumTopicId
cf1111c1c11feddfaeb4bdef Subtract One Number from Another with JavaScript 1 https://scrimba.com/c/cP3yQtk 18314

Description

We can also subtract one number from another. JavaScript uses the - symbol for subtraction.

Example

myVar = 12 - 6; // assigned 6

Instructions

Change the 0 so the difference is 12.

Tests

tests:
  - text: The variable <code>difference</code> should be equal to 12.
    testString: assert(difference === 12);
  - text: You should only subtract one number from 45.
    testString: assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code)));

Challenge Seed

var difference = 45 - 0;


After Test

(function(z){return 'difference = '+z;})(difference);

Solution

var difference = 45 - 33;