freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../basic-javascript/use-the-parseint-function.a...

1.1 KiB

id title challengeType videoUrl localeTitle
587d7b7e367417b2b2512b23 Use the parseInt Function 1

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert(/parseInt/g.test(code), "<code>convertToInteger</code> should use the <code>parseInt()</code> function");'
  - text: ''
    testString: 'assert(typeof(convertToInteger("56")) === "number", "<code>convertToInteger("56")</code> should return a number");'
  - text: ''
    testString: 'assert(convertToInteger("56") === 56, "<code>convertToInteger("56")</code> should return 56");'
  - text: ''
    testString: 'assert(convertToInteger("77") === 77, "<code>convertToInteger("77")</code> should return 77");'
  - text: ''
    testString: 'assert.isNaN(convertToInteger("JamesBond"), "<code>convertToInteger("JamesBond")</code> should return NaN");'

Challenge Seed

function convertToInteger(str) {

}

convertToInteger("56");

Solution

// solution required