this post was submitted on 13 Jun 2023
7 points (100.0% liked)

/kbin meta

639 readers
1 users here now

Magazine dedicated to discussions about the kbin itself. Provide feedback, ask questions, suggest improvements, and engage in conversations related to the platform organization, policies, features, and community dynamics. ---- * Roadmap 2023 * m/kbinDevlog * m/kbinDesign

founded 1 year ago
 

Apparently there's some sort of fix in the pipeline related to this, but at the very least, I'd like to be able to type kbin.social/m/kbinmeta and be redirected to kbin.social/m/kbinMeta

top 11 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)
[–] [email protected] 1 points 1 year ago

Great to read this, hopefully this fix will be implemented ASAP

[–] [email protected] 0 points 1 year ago (2 children)

var magazineString = ‘kBiNmEta’;
var magazineString = magazineString.toLowerCase();

Or something

Edit: Damn i'm getting downvoted. I'm just learning javascript for the first time after Python, what am I writing wrong?

[–] [email protected] 1 points 1 year ago (1 children)

They might be downvoting you because you're basically declaring the variable twice, with the same name, too. If someone knows better, though, please correct me.

Either of the following should work just as well:

var magazineString = 'kBiNmEta';
magazineString = magazineString.toLowerCase();

var magazineString = 'kBiNmEta'.toLowerCase();

Another reason some people may be upset is that they see it as downplaying the complexity of the issue, I suppose, but I'm not going to play psychic here or put words into peoples' mouths. One thing I'll say for certain is if there's anything I learned about any sort of work, is that it's always far more complicated than it sounds/looks like; applies especially well to software.

But don't you get discouraged! Learning to code yields great result even if you decide to not pursue the career with it for whatever reason - it's fun, it's rewarding, you can easily turn into something useful, you can contribute to open source, etc. There's always something.

[–] [email protected] 0 points 1 year ago (1 children)

That makes more sense, thanks!

[–] [email protected] 1 points 1 year ago

Another thing on the technical side is using "var" is frowned upon. It was replaced with "let" in 2015. The new keyword has over 96% browser support and is safer.

The gist of it is "var" makes it easy to produce silent failures. That means your code will run but the results will be wrong and you'll wonder why because there's no error message. Uncountable hours were wasted fiddling with logic that wasn't wrong in the first place but worked on "corrupted" inputs. For your own sanity use "let" unless you cannot (legacy systems). You won't need to consider anything, it just works better. If you want to learn specifics, relevant topics are scopes, variable hoisting and the global object.

[–] [email protected] 0 points 1 year ago (1 children)

what am I writing wrong?

your comment didn't offer anything. Good for you for learning JS I guess, but what did you expect from this comment?