javascript-tutorial / en.javascript.info

Modern JavaScript Tutorial

Home Page:https://javascript.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discrepancy in typeof(alert) Result in JavaScript Tutorial

Aditya-Ramachandran opened this issue · comments

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

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 )

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