Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COPY EDIT] Mistake in example code output for pop() #355

Open
dman620 opened this issue Jan 12, 2022 · 0 comments
Open

[COPY EDIT] Mistake in example code output for pop() #355

dman620 opened this issue Jan 12, 2022 · 0 comments

Comments

@dman620
Copy link

dman620 commented Jan 12, 2022

Permalink

https://education.launchcode.org/intro-to-professional-web-dev/appendices/array-method-examples/push-and-pop-examples.html#pop

Issue

The last example on the page tells the students how to use the pop() function

let arr = ['a', 'b', 'c', 'd', 'e'];
arr.pop();
console.log(arr);

the output being

e
['a', 'b', 'c', 'd']

Only, that's a typo. the pop() function does not write to the console. You should either use console.log(arr.pop()); or remove the logging of the popped element. Combined with the correct usage of push() makes for confusion when learning the difference between returned values and printed values.

(Optional) Screenshot

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant