r/JavaScriptTips • • Dec 10 '24

Markup is Functional Oriented

5 Upvotes

r/JavaScriptTips • • Nov 13 '24

Understanding Bitwise Shifts in JavaScript: << and >>

Thumbnail trevorlasn.com
5 Upvotes

r/JavaScriptTips • • Sep 28 '24

Learn how to read nested callbacks

5 Upvotes

I came across a post on r/learnjavascript where the OP was asking about the mental framework to have for understanding nested callback code.

Most of the comments there didn’t answer the OP's question. They suggested that we shouldn’t be writing such code and should instead use promises. While that’s valid advice, what if you are reading someone else's code? How do you make sense of it?

Since I can’t cover everything here, I’ve written an article based on that example. It begins by explaining how such code is written. Once you understand how it’s constructed, you will also learn how to read it.

Give it a read!


r/JavaScriptTips • • Mar 07 '24

7.8.6 totals of lots of rolls

Post image
5 Upvotes

r/JavaScriptTips • • Feb 04 '24

Learning vanilla/NodeJS

5 Upvotes

Hello i need resources to effectively help me learn vanilla js without going through youtube...please help i dont want to get overwhelmed and quit again...i already have a little experience


r/JavaScriptTips • • Jan 21 '24

Pokémon Auto Image Slideshow using HTML CSS and JavaScript

Thumbnail
youtu.be
5 Upvotes

r/JavaScriptTips • • Nov 21 '23

Learn Javascript Visually

5 Upvotes

I created this channel on Youtube aiming at teaching how to code visually. I hope I can acheive it. I made some videos up until now and want to make it richer.

I know the visual element is poor or non-existent now, but I promise to make it better.

https://www.youtube.com/channel/UCcA0KbVo49DlEyHZe8Mk0Aw


r/JavaScriptTips • • Oct 10 '23

How to Create a Sticky On Scroll Effect with JavaScript

5 Upvotes

r/JavaScriptTips • • Jul 31 '23

Useful AI tool for developer https://www.unit-test.dev/ - helps to quickly create unit tests for your code

5 Upvotes

r/JavaScriptTips • • Jun 22 '23

JavaScript array: The ultimate guide you need to start with

Thumbnail
tecforfun.com
5 Upvotes

r/JavaScriptTips • • Apr 20 '23

Best of unknown JavaScript features

5 Upvotes

r/JavaScriptTips • • Apr 11 '23

95%+ of the content on this sub is better explained here

Thumbnail
javascript.info
5 Upvotes

r/JavaScriptTips • • Apr 08 '23

5 Ways to Count Number of Occurrences in JavaScript Array

5 Upvotes

If you're working with arrays in JavaScript, you might find yourself needing to count the number of times a certain element appears in the array. Fortunately, JavaScript provides an easy and efficient way to do this with just a few lines of code.

To count the number of occurrences of an element in a JavaScript array, we can use the reduce() method. The reduce() method is used to apply a function to each element in an array and reduce the array to a single value.

Here's an example code snippet that demonstrates how to use reduce()
to count the number of occurrences of each element in an array:

const arr = ['apple', 'banana', 'apple', 'cherry', 'banana', 'apple'];

const countOccurrences = arr.reduce((acc, curr) => {
  acc[curr] = acc[curr] ? acc[curr] + 1 : 1;
  return acc;
}, {});

console.log(countOccurrences);

In this code, we first define an array arr with some elements. Then, we use the reduce() method to count the number of occurrences of each element in the array.

The reduce() method takes a callback function that is called for each element in the array. In the callback function, we first check if the current element already exists in the accumulator object (acc), and if so, we increment its count by 1. Otherwise, we set its count to 1.

Finally, the reduce() method returns the accumulator object with the counts for each element. In this example, the output will be:

{ apple: 3, banana: 2, cherry: 1 }

By using reduce() to count the occurrences of elements in an array, we can efficiently and easily handle this common programming task in JavaScript. Whether you're working with small or large arrays, this method can help you quickly and accurately count the number of times each element appears.

Learn other ways to Count Number of Occurrences in Array


r/JavaScriptTips • • Mar 30 '23

Debugging JavaScript in Chrome DevTools | STOP using console log everytime

Thumbnail
youtube.com
5 Upvotes

r/JavaScriptTips • • Jan 20 '23

JavaScript beginner

5 Upvotes

Hi guys! I want to start learning JavaScript, which book do you recommend me to start from the begining?


r/JavaScriptTips • • Dec 31 '22

Learning to code? Best strategy?

5 Upvotes

So I’ve been sloooowly but surely learning about the basics of coding html,css and JavaScript. I am In no way comfortable with using them yet and putting it to practice. I realize I learn best doing a project and then learning as I go. Seeing it put in use is obviously the best way to learn. Since I’m a beginner tho can anyone recommend how to go about it. Should I just make a mock website. I guess I’m just looking for advice and tips.


r/JavaScriptTips • • Dec 11 '22

I'm trying to write a function that puts objects I create with it into an array by the variable used to create it, but so far I'm only able to get the object itself in the array. Can someone point in the in right direction as to what I may be missing? I'd want circles to be [circle1, circle2] output

Post image
5 Upvotes

r/JavaScriptTips • • Nov 27 '22

A beginner’s guide to parse and create XML with Node.js

Thumbnail
geshan.com.np
5 Upvotes

r/JavaScriptTips • • Nov 21 '22

Understanding Prototypes in JavaScript

5 Upvotes

In programming, we often want to take something and extend it.

As an example, we have an animal object with its properties and methods. We want to make cat
and dog objects with certain properties and methods on top of animal. We’d like to reuse what we have in animal, not copy/reimplement its methods, just build a new object on top of it.

Prototypes are the underlying feature in JavaScript that makes it possible for objects to inherit and share properties among themselves.

Check out the post to understand what prototypes really are and how they help in inheritance.


r/JavaScriptTips • • Nov 12 '22

Weather App with openwebmaster API and CSS, HTML

Thumbnail
youtu.be
5 Upvotes

r/JavaScriptTips • • Oct 20 '22

leetcode for frontend series | Part 5 of 97

5 Upvotes

A tricky question on scope in JavaScript with 2 different approaches explained. Solving these type of questions will tremendously strengthen your knowledge in JavaScript.

link - https://www.youtube.com/watch?v=6H1VpuT7rVE


r/JavaScriptTips • • Oct 11 '22

How to use NPM Chalk to colorize and format your console output

Thumbnail
geshan.com.np
5 Upvotes

r/JavaScriptTips • • Sep 27 '22

JSON

5 Upvotes

Hello I need help, I have assignment to create quiz using JSON, here is data.json and I need to parse it to get quiz form like this, and after that i need to import local storage but that is not problem, problem is to parse it to create questions like this.

I don't have too much time to do this so can someone help me how to do this, thank you <3.

var json = '{"quiz": {"q1": {"question": "Which one is correct team name in NBA?","options": ["New York Bulls","Los Angeles Kings","Golden State Warriros","Huston Rocket"],"answer": "Huston Rocket"}, "q2": {"question": "Namaste is a traditional greeting in which Asian language?","options": ["Hindi","Mandarin","Nepalese","Thai"], "answer": "Hindi"},"q3": {"question": "The Spree river flows through which major European capital city?","options": ["Berlin","Paris","Rome","London"],"answer": "Berlin"},"q4": {"question": "Which famous artist had both a Rose Period and a Blue Period?","options": ["Pablo Picasso","Vincent van Gogh","Salvador Dalí","Edgar Degas"],"answer": "Pablo Picasso"}}}'


r/JavaScriptTips • • Sep 23 '22

Introduction to ReactJS

Thumbnail
medium.com
5 Upvotes