Skip to content
This repository was archived by the owner on Sep 25, 2019. It is now read-only.
This repository was archived by the owner on Sep 25, 2019. It is now read-only.

Basic JavaScript: Increment a Number with JavaScript - fails for pre-increment #199

@kevinsmithwebdev-zz

Description

@kevinsmithwebdev-zz

The problem does not specify a pre-increment (++myVar) or post-increment (myVar++).

One test:

{
  "text": "Use the <code>++</code> operator",
  "testString":
    "assert(/[+]{2}\\s*myVar|myVar\\s*[+]{2}/.test(code), 'Use the <code>++</code> operator');"
},

allows either, but another test:

{
  "text": "<code>myVar = myVar + 1;</code> should be changed",
  "testString":
    "assert(/var\\s*myVar\\s*=\\s*87;\\s*\\/*.*\\s*myVar\\+\\+;/.test(code), '<code>myVar = myVar + 1;</code> should be changed');"
},

fails for pre-increment.

The problem description should either say specifically "post" or the tests should allow either.

A fair number of campers are getting tripped up on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions