No AttributeError: undefined and the Crash That Comes Later

At the start of this course, the setup check broke in two languages with the same one-letter slip. The Python script asked for sys.platfrom and stopped. The JavaScript port asked for process.platfrom, ran to the end, and printed OS: undefined into the report bound for the onboarding channel.

That left two questions open: why was there no error, and how would you have spotted the slip? In this lesson, you’ll meet the value behind that hole in the report and see why its trouble often shows up lines after the slip. Start with the line that went quiet.

Read a Property That Isn’t There

What Python calls an attribute, JavaScript calls a property. Here’s the line from the Python script, with the slip:

Language: Python
print("OS:", sys.platfrom)

Python finds no platfrom on the sys module and stops on that line with AttributeError: module 'sys' has no attribute 'platfrom'. Did you mean '.platform' instead of '.platfrom'? The mistake and the error sit on the same line.

The JavaScript port makes the same request of process:

Language: JavaScript
console.log("OS:", process.platfrom);

Run it, and JavaScript prints its line and carries on:

Language: Program Output
OS: undefined

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.