Skip to content

Lesson 03 "my first io" - wc -l makes excercise confusing #2

@kmassada

Description

@kmassada

wc -l does not count the number of lines, but counts the number of new lines, the exercise remains ambiguous about clarifying that

a file with no trailing new line,
wc -l will only return 2

"a
b
c"

similar to the exercise. trailing new line counts.
this will decide if you need a -1, or not
console.log(fileContents.toString().split('\n').length-1);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions