Skip to content

Add explanation of Unary plus (+) operator to Extract for money strings exercise #3685

@martinDolan

Description

@martinDolan

The solution to Extract the money problem, uses the unary + operator, however, I don't see that explained anywhere in the Strings section. Adding an explanation of that would be helpful.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unary_plus

function extractCurrencyValue(str) {
  return +str.slice(1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions