r/learnjavascript • u/kaowpun • Jan 25 '26
Make minesweeper clone as my first JS project.
A lot harder than I thought. Any feedback is appreciated.
Github Link: Click here
Live Demo: Click here
Art Credit: Thanks Kia for free art asset 🙏
r/learnjavascript • u/kaowpun • Jan 25 '26
A lot harder than I thought. Any feedback is appreciated.
Github Link: Click here
Live Demo: Click here
Art Credit: Thanks Kia for free art asset 🙏
r/learnjavascript • • Jan 25 '26
r/learnjavascript • u/Even-Chicken5282 • Jan 25 '26
I am a beginner in JavaScript and I can understand normal and higher order functions but applying them seems really challenging, I was wondering if you guys have any tips that I can use to improve, and if there are any sureshot ways to build really strong logic.
Any advice is highly appreciated!
r/learnjavascript • u/GloomyAdagio7917 • Jan 25 '26
I am working in visual studio code and I am very new to javascript.
In this part of my assignment I must write my own reducer function then use that reducer function to find out how many small, medium, and large transactions there are. A transaction is a dictionary of information, one of which is "amount". The transactions variable is an array of these dictionaries.
here is the code:
let smallTransactions = reduce(transactions, (value, count) => {
if(value["amount"] < 25) count += 1; return count;}, 0);
let mediumTransactions = reduce(transactions, (value, count) => {
if(value["amount"] >= 25 && value["amount"] < 75) count += 1; return count;}, 0);
let largeTransactions = reduce(transactions, (value, count) => {
if(value["amount"] >= 75) count += 1; return count;}, 0);
console.log("Small: " + smallTransactions);
console.log("Medium: " + mediumTransactions);
console.log("Large: " + largeTransactions);and the reduce function:
function reduce(data, reducer, initialValue) {
let product = initialValue;
for (let element of data) {
product = reducer(element, product);
}
return product;
}It is supposed to return this:
Number of small transactions: 1150
Number of medium transactions: 2322
Number of large transactions: 8315but instead its returning this:
Number of small transactions: 1425
Number of medium transactions: 2404
Number of large transactions: 8594Any idea why its doing that? I can't figure it out.
r/learnjavascript • u/Due_Eggplant_729 • Jan 24 '26
I want to ask a user to input their first name, and the state were they live. Then send to a database. I am a NEWBIE. Help. Note: I did download node.js. I really don't know what I'm doing yet. Looks for a simple program to do this on my laptop. Any help appreciated.
r/learnjavascript • u/SnurflePuffinz • Jan 24 '26
i was wondering, would this code be syntactically OK? i imagine there might be scenarios where you want all the functionality of the superclass method, but then you simply want to add more statements (more implementation) to it... could this work?
r/learnjavascript • u/GloomyAdagio7917 • Jan 24 '26
This is my first time actually coding in javascript but I have experience in python and java. I am using Visual Studio Code and it is my first time using it.
I coded this very basic reduce function. The way I call this function results in a series of arrays. Everything other than the reduce function itself is provided to me by my teacher so I would perfer not to change it.
const nums = [1,2,3,4,5];
const evensAndOdds = reduce(nums, (value, acc) => { if (value % 2 == 0) { acc.evens.push(value); } else { acc.odds.push(value); } return acc; }, {evens: [], odds: []});
console.log(evensAndOdds);
function reduce(data1, reducer, initialValue) { let reducedProduct = 0;
for (let element of data1) {
let product = reducer(element, initialValue);
reducedProduct += product;
}
return reducedProduct;}
0[object Object][object Object][object Object][object Object][object Object]
========================================================================= I want to be able to see the actual values. The example provided to me by my teacher says the result should be //{evens: [2,4], odds: [1,3,5]}; I understand my code could be wrong but I wont really know unless I can see the actual values.
r/learnjavascript • u/CombinationStunning8 • Jan 24 '26
Hi r/learnjavascript !
I'm working on this directory that compiles around 50 lightweight JS tools that requires absolutely no npm installs and no build steps, allowing for a streamlined dev experience, just a simple script tag and start coding! Would really like some feedback on my selection of the tools and engines or any tools you would like added to the website!
I thought these simple tools and setup processes would make it easier for beginner devs and everyone else alike to learn JS easier and experiment without needing to type in "npm install" ever again (i am being a bit overdramatic here with the repeated mentions of npm install, yes, but...)
Thank you all so much! :)
The website: https://vietnamesecoder.github.io/nobuild/
r/learnjavascript • u/Basic_Salamander_484 • Jan 24 '26
I realized that every time I start a new project, I waste days setting up the same boilerplate: Database, Auth, and most annoyingly a basic Admin Panel to manage users. Most tutorials stop at "Here is a JWT," but in the real world, we always need roles (Admin/User), session management, and a way to edit users without touching the raw DB.
So, I built templateAuthByPassphrase.
The Goal This is meant to be a "Clone & Go" template for freelance projects or internal tools. I need your feedback: specifically on the security implementation and the project structure. Is this "production-ready" enough for a mid-sized project?
Key Features (The "Adult" Stuff) I tried to avoid common tutorial pitfalls and focus on security and operations:
localStorage.RBAC (Role-Based Access Control): Native support for USER vs ADMIN roles.
Security hardening:
LoginAudit table tracks every success/failure with User-Agent and IP.Dev vs Prod Docker Workflow:
I’d appreciate any feedback about usabillity, security, or issues if you find a bug!
github.com/davy1ex/templateAuthByPassphrase