Skip to content

Variables and Operators lesson : Fix misleading Filename #29849

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

Closed
wants to merge 1 commit into from

Conversation

xerxes324
Copy link

Changed from "no name .js " to " noname.js " for better clarity, as the former might confuse people into creating a literally empty .js file.

Because

" no name .js " can be confusing for people as it might lead them to think its an empty .js file which can cause an error. Changing it to noname.js can probably help avoid the confusion.

[ At the very least, it can be changed from the existing " no name .js " to " noname .js ". ]

This PR

  • no name .js changed to noname.js in the variables_and_operators section of the Foundations Course.

Issue

Closes #XXXXX

Additional Information

Link to discord discussion : https://discord.com/channels/505093832157691914/505093832157691916/1391852492329062410

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

Changed from "no name `.js` " to " `noname.js` " for better clarity, as the former might confuse people into creating a literally empty .js file.
@github-actions github-actions bot added the Content: Foundations Involves the Foundations content label Jul 7, 2025
Copy link
Member

@rlmoser99 rlmoser99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the confusion, but what it is saying here is that there is no name. The file is just .js. I am open to clarifying the sentence.

@@ -65,7 +65,7 @@ Another way to include JavaScript in a webpage is through an external script. Th

JavaScript files have the extension `.js` similar to `.css` for stylesheets. External JavaScript files are used for more complex scripts.

We named our file `javascript.js` but we could have chosen any name like `my-script.js` or even no name `.js`. What is really important is the `.js` extension.
We named our file `javascript.js` but we could have chosen any name like `my-script.js` or even `noname.js`. What is really important is the `.js` extension.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We named our file `javascript.js` but we could have chosen any name like `my-script.js` or even `noname.js`. What is really important is the `.js` extension.
We named our file `javascript.js` but we could have chosen any name like `my-script.js` or `.js` without a name. What is really important is the `.js` extension.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://discord.com/channels/505093832157691914/505093832157691916/1391831840867881131

Well, this was the source of the confusion. someone tried it and it gave them an error ( possibly because of the naming? )
I'm not sure, please do clarify.

Copy link
Contributor

@MaoShizhong MaoShizhong Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems if the script src leads to a file name that begins with a dot, the browser interprets the MIME type as text/html even if it's explicitly set to text/javascript (which would otherwise be implicit). Tested this with various file names inc. .n.js and n.js, both with and without the leading ./
.js as a plain file name does work when running via node e.g. node .js but in this example, it'll be better to use an example other than nameless .js

The .js also isn't the important part either. Naming and src-ing the file javascript.rb will work just fine (with JS code of course), as long as the path indicates a file (just javascript no extension will end up with a MIME type of text/html, even if explicitly set in the script tag.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried it, and .js as a plain file name also does work in browser console and also with node .js as clarified by @MaoShizhong. Thankyou so much for clarification.

@xerxes324 xerxes324 closed this Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Foundations Involves the Foundations content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants