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

Discrepancy in typeof(alert) Result in JavaScript Tutorial #3666

Closed
Aditya-Ramachandran opened this issue Feb 10, 2024 · 2 comments
Closed

Comments

@Aditya-Ramachandran
Copy link

Description

In the tutorial, it states that the result of typeof(alert) is a funciton, but when I tested this on my local machine and another online JavaScript compiler (Programiz), the result was consistently undefined. This inconsistency is causing confusion, and I believe there might be an error in the tutorial content.

Expected Result:

The tutorial should accurately represent the result of typeof(alert) to avoid confusion among learners.

Actual Result:

The tutorial claims the result of typeof(alert) is a funciton, but real-world testing yields 'undefined'.

Screenshots

From testing it on my machine:
Screenshot 2024-02-10 200551

From the tutorial:
Screenshot 2024-02-10 201635

@joaquinelio
Copy link
Member

it IS function, in the browser environment.
what the tutorial aims

If you use it outside the browser window environment, "alert" would mean what that environment wants it to be, maybe an undefined variable.

Try console.log( typeof console.log )

@Aditya-Ramachandran
Copy link
Author

Thank you for the clarification! I understand now that the typeof(alert) result is specific to the browser environment.

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

No branches or pull requests

2 participants