freeCodeCamp/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.english.md
Oliver Eyton-Williams f1c9b08cf3 fix(curriculum): add isHidden: false to challenges
This includes certificates (where it does nothing), but does not
include any translations.
2020-05-25 16:25:19 +05:30

1.1 KiB

id, title, challengeType, isHidden, videoUrl, forumTopicId
id title challengeType isHidden videoUrl forumTopicId
cf1111c1c11feddfaeb4bdef Subtract One Number from Another with JavaScript 1 false 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(code.replace(/\s/g, '')));

Challenge Seed

var difference = 45 - 0;


After Test

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

Solution

var difference = 45 - 33;