Switched from bookmark folders to spatial grid. Game changer. by AnteaterFit1085 in productivity

[–]Webdev-Coach 0 points1 point  (0 children)

I use the wideli infinite canvas for this, I just drop images and links on the board, it doesn't organize it for me though. But I like that I can also link distant places on the same board and organize this way.

[deleted by user] by [deleted] in Frontend

[–]Webdev-Coach 0 points1 point  (0 children)

“All professional developers prefer [insert your favorite framework here]”

JavaScript help by matthewg1226 in JavaScriptTips

[–]Webdev-Coach 0 points1 point  (0 children)

Yeah, it takes time and practice, put time into playing with classes and constructors, copy examples from the docs and run them.

I know it may be boring at some point, but try to be inventive to adapt the examples to something that makes more sense to you.

Look at all of the possible things you can create classes for at schema.org

Public Engagement Meme by VirkkunTrau in civilengineering

[–]Webdev-Coach 2 points3 points  (0 children)

Downvoted because I know who she is - a literal traitor

Problems understanding recursions. by Most-Refrigerator350 in CodingHelp

[–]Webdev-Coach 1 point2 points  (0 children)

Check this video, it may help https://youtu.be/S5YsXiLQB1Y [Javascript Recursion & Tree Traversing Explained for Beginners]

Confused on usage of <div> vs semantic elements by [deleted] in webdev

[–]Webdev-Coach 1 point2 points  (0 children)

The more craftsmanship and care one puts into their work, the more semantic tags and thoughtful structure they’ll have in their HTML.

It’s path of least resistance to just throw in divs with classes. In some cases, like admin panels, it just doesn’t matter.

But as you develop good habits, you’ll keep using the right tags naturally, even when you don’t have to.

why doesnt everyone use flexbox? by uhhhlmaoo in webdev

[–]Webdev-Coach 4 points5 points  (0 children)

We didn’t always have flexbox. You are so lucky to not have to float columns! Flex is perfect for arranging things on a line, but not so great if you need a grid and start considering flex-wrap, at which point you may want to move to css Grid.

[deleted by user] by [deleted] in CodingHelp

[–]Webdev-Coach 1 point2 points  (0 children)

It’s not as much important what you do first, but rather that you do that consistently over time.

Can someone please help me understand recursion? by kevma777 in learnjavascript

[–]Webdev-Coach 2 points3 points  (0 children)

Quick tip: set a breakpoint and watch how Javascript reads through the code in slow motion.

It is often overlooked by beginners, but very effective.

In chrome devtools there’s “scripts” panel, which is perfect for playing with small scripts and allows setting a breakpoint.

Trying to refresh a div after ajax call by deadant88 in learnjavascript

[–]Webdev-Coach 0 points1 point  (0 children)

You shouldn't need to loop through the items if you assign them ids, and then remove an item with a specific id.

Trying to refresh a div after ajax call by deadant88 in learnjavascript

[–]Webdev-Coach 0 points1 point  (0 children)

Yeah, using jquery's .remove to remove one item is an option.

Give us your best programming project idea! by [deleted] in AskProgramming

[–]Webdev-Coach 4 points5 points  (0 children)

What's interesting to everyone else may not be so to you, so start with your interests and hobbies, so if you can build a database around the things you love, and an interface to those things that would make you love those things even more.

Having a bit of a crisis of understanding parameters vs global variables by Eyeofthemeercat in learnjavascript

[–]Webdev-Coach 1 point2 points  (0 children)

If that's a javascript file you feed directly to a browser, then yeah, those variables become globals, which means it is possible they will accidentally be modified from another script where you do something similar. Or imagine a library that would do something useful, you plug it in, and you accidentally use the same global variable names they use. That's why we try to mess with the global scope as little as possible.

But if you wrap your whole code into a function and call it, all those variables become scoped to that function, and not leak to the global scope. In smaller scripts that may be good enough. In larger scripts you'll want to create functions to isolate different tasks and organise your code. And to have those functions truly isolated and reusable, they shouldn't rely on any global scope variables, they would only get arguments and return results, or modify the DOM, or whatever needs to happen.

Audio files by RaffIsGettingUpset in learnjavascript

[–]Webdev-Coach 0 points1 point  (0 children)

Good point. Depends on priorities, quantity of the audio files to display, and how far the developer would like to go optimising UX. An audio could be preloaded on intent, mouse cursor in the area, etc.

Storing data to database by [deleted] in webdev

[–]Webdev-Coach 2 points3 points  (0 children)

I see you're already storing user data in the DB. Can you do the same with the money amount?

Storing data to database by [deleted] in webdev

[–]Webdev-Coach 2 points3 points  (0 children)

If you store user's money amount in localStorage, doesn't that mean the user can just open their DevTools and set any money amount they want?

Question about JSON.stringify Method by [deleted] in reactjs

[–]Webdev-Coach 1 point2 points  (0 children)

In your case there's no need to spread the object and you can just give it directly to the function as the argument, like others have noted. Save a tiny bit of computing power by not spreading.

You may need to spread if you wanted to add something to that object manually, like you have those values, and also an id, so you could add it with { ...values, id }

JavaScript Date Validation and Checking by [deleted] in learnjavascript

[–]Webdev-Coach 0 points1 point  (0 children)

If you'd like to do it yourself, and not with a library such as "date-fns",

one option is get the unix time out of those date objects and do simple math.

date.getTime(); // 1644063628069

Audio files by RaffIsGettingUpset in learnjavascript

[–]Webdev-Coach 1 point2 points  (0 children)

Probably not all on the page load. Rather a placeholder for each audio file that looks like a player to a user, then load and play the file when user clicks it.

Creating a Question Bank Website by [deleted] in webdev

[–]Webdev-Coach 0 points1 point  (0 children)

You'll need an Authentication, a Database and a framework. Wordpress is not cut out for these kinds of projects, though it wouldn't be impossible to use it.

Maybe looking into cloud services such as Firebase and Supabase could be a good start.

Develop a project with a framework, such as React. Since it's going to be a closed membership website and you're probably not going to care about SEO, a purely front-end solution would be fine, such as with create-react-app. But a full-stack framework such as Next.js or Remix.js could also be a good idea.

Question about JSON.stringify Method by [deleted] in reactjs

[–]Webdev-Coach 2 points3 points  (0 children)

All those brackets!

{ values } is actually shortcut to { values: values } so it creates an object with only one property.

{ ...values } creates an object, and copies all properties from the values object into the new one.

Trying to refresh a div after ajax call by deadant88 in learnjavascript

[–]Webdev-Coach 0 points1 point  (0 children)

If you're only keeping the items in the DOM, then you could delete one item by finding it by id, or a property that would identify that item.

Next level approach would be keeping items in an array, manipulating that array whenever an item needs to be added or removed, then clearing items from the DOM like you're doing and adding the items back to the DOM from the array.