Skip to content

Type Casting & Coercion: Bitshifting both bad and good? #80

@wildlyinaccurate

Description

@wildlyinaccurate

In the Type Casting & Coercion section, you've got the following:

// bad
var val = inputValue >> 0;

// good
/**
 * parseInt was the reason my code was slow.
 * Bitshifting the String to coerce it to a
 * Number made it a lot faster.
 */
var val = inputValue >> 0;

Can you clarify whether bitshifting is good or bad?

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