Skip to content

The function getNextId in 02_Challenge and 02_Solution does not behave correctly #3

@maerqin

Description

@maerqin

Issue Overview

The function getNextId always return the number 1, independent of the array given. Shouldn't the function return the biggest id plus 1? I fixed the issue by switching max and x.id in the conditional.

Describe your environment

Typescript Version 4.7.4
node.js v16.16.0

Steps to Reproduce

  1. Run the program.
  2. The property id is 1 instead of 4 of the next todo item.

Expected Behavior

The property id from the next todo item should be 4.

Current Behavior

The id is 1.

Possible Solution

Switch max and x.id in the conditional.

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