r/JavaScriptTips • u/Rajnish04 • Apr 16 '22
r/JavaScriptTips • u/NoMany8287 • May 23 '21
Creating a Real-Time QR Code Scanner With Vanilla JavaScript
r/JavaScriptTips • u/CrayonConstantinople • Jun 23 '19
Arrow functions are clean, simple and retain correct scope for 'this'
r/JavaScriptTips • u/keyframeeffects • Dec 27 '24
Flipping Menu Toggle || HTML CSS & JavaScript
r/JavaScriptTips • u/hardfire005 • Jun 04 '24
Which JavaScript book is good if a person later on wants to move to frameworks
Hello everyone, can you please suggest me a good JavaScript book that can be read and later on the person can move on to JavaScript framework/libraries.
Please note that the person is a computer science teacher at higher secondary level and want to switch to full time coding career. He is more comfortable with books than tutorials. ( I recommended him Jonas's udemy course but he want to read from book)
I have also gone through some subs and found that people don't recommend Eloquent JavaScript book to beginners anymore.
Please help him with probably a good and easy to understand book, if latest edition available then its would be even best.
Thanks in advance.
r/JavaScriptTips • u/mkazemiraz • Jul 05 '23
Invitation to Contribute: Join the Circle of JavaScript Developers in Building a Repository of One-Line Javascript Codes
I wanted to share an exciting project I've been working onβa carefully curated repository of concise and efficient one-line JavaScript codes. It's a collection of powerful solutions to common programming challenges.
But I believe that true success comes from collaboration. That's why I'm reaching out to all of you, seasoned developers and aspiring coders alike, to contribute your expertise to this growing resource. Your unique perspectives and ideas are highly valued in our community.
By sharing your own one-liners, suggesting improvements, or providing feedback on existing codes, we can collectively build a comprehensive library of JavaScript utility codes. Together, we can simplify complex tasks and boost productivity.
Interested in getting involved? Visit here to explore the existing collection and contribute your own gems. Every contribution, no matter how small, makes a difference. Let's collaborate and create something remarkable!
I'm truly excited to witness the collective knowledge and talent of this community in action. Together, we can unlock the full potential of one-line JavaScript codes and make a lasting impact in the programming world. Join me on this journey, and let's create something extraordinary!
r/JavaScriptTips • u/[deleted] • Jun 12 '23
I have coded a text animation but its triggering at page load i want it to trigger when the element(heading) is in viewport. Please help!
<script> $(document).ready(function(){ var text = ["Solving Accounting Problems For High Growth Companies."]; var i = 0; var j = 0; var speed = 18; /* The speed/duration of the effect in milliseconds */ function typeWriter() { if (i < text[j].length) { document.getElementById("demo").innerHTML += text[j].charAt(i); i++; setTimeout(typeWriter, speed); } } typeWriter(); }); </script>
r/JavaScriptTips • u/[deleted] • May 10 '23
How to Convert Array to String without Commas in JS?
JavaScript arrays are an incredibly useful tool when working with sets of data. They allow developers to store multiple values in a single variable and perform operations on those values using built-in array methods. However, there are times when you may need to convert an array to a string without using commas.
Why convert an array to a string without commas?
By default, when you convert an array to a string in JavaScript, the values in the array are separated by commas. For example, if you have an array of strings like this:
const fruits = ["apple", "banana", "orange"];And you use the toString() method to convert it to a string:
const fruitsString = fruits.toString();
console.log(fruitsString); // "apple,banana,orange"You can see that each value in the array is separated by a comma. While this may be useful in some cases, there are times when you may want to convert the array to a string without using commas. One common use case is when you want to display the values in a sentence or paragraph, without the interruption of commas.
How to convert an array to a string without commas?
There are several ways to convert an array to a string without using commas in JavaScript. Here are three methods you can use:
Using the **join()**method with an empty string:
The join() method in JavaScript allows you to join all the elements of an array into a single string. By default, the method separates the elements with commas. However, you can pass an empty string as an argument to the method, which will remove the commas and join the elements together. Here's an example:
const fruits = ["apple", "banana", "orange"];
const fruitsString = fruits.join("");
console.log(fruitsString); // "applebananaorange"As you can see, the resulting string contains all the values in the array joined together without any commas.
Using the reduce() method:
The reduce()method in JavaScript allows you to reduce an array to a single value. You can use it to concatenate all the values in the array into a single string without commas. Here's an example:
const fruits = ["apple", "banana", "orange"];
const fruitsString = fruits.reduce((acc, curr) => acc + curr);
console.log(fruitsString); // "applebananaorange"In this example, the reduce() method takes two arguments: a callback function and an initial value (in this case, an empty string). The callback function takes two parameters: an accumulator (acc) and the current value of the array (curr). In each iteration, the callback function concatenates the accumulator with the current value, which eventually produces the final string.
r/JavaScriptTips • u/Low_Mammoth_9371 • Mar 20 '23
How to create form data payloads of different types in JavaScript π¦
r/JavaScriptTips • u/Low_Mammoth_9371 • Feb 10 '23
QR code scanning with Html5-QRcode.js β¨
r/JavaScriptTips • u/geshan • Aug 18 '22
Node.js alternatives with Javascript, exploring Deno and Bun (includes code examples)
r/JavaScriptTips • u/pankaxz • May 29 '22
I am trying to create a Factory Pattern to create DOM elements. Is this the correct way? I would be using observers in the Controller to interact with View and Model.
r/JavaScriptTips • u/xplodivity • May 26 '22
Closures in JavaScript simplified
I have been repeatedly asked about closures in JavaScript, lexical environment and more such similar concepts in interviews. Heres a 7 min video answering all such concepts regarding the same.
link: https://www.youtube.com/watch?v=8nlyXYhvK_A
r/JavaScriptTips • u/Mighty_Ghost_Hack • May 20 '22
Debouncing and Throttling In Javascript
r/JavaScriptTips • u/xplodivity • Apr 11 '22
8 unique projects to master Vanilla JavaScript
After a lot of research on some core projects and topics on vanilla JavaScript, i came up with a video on 8 small but unique projects that mostly covers up a lot of in depth concepts in vanilla JavaScript, I am sure anybody who ends up building all these projects, will definitely level themselves up.
And if anybody viewing this post has already built any of these projects, then feel free to share them here. it would be great. I am myself building these projects and share it over here soon.
https://www.youtube.com/watch?v=Q-uAdcVKEXs

r/JavaScriptTips • u/keraito • Jan 18 '22
Do You Need To Master JavaScript Before Learning React?
r/JavaScriptTips • u/suresh9058 • Dec 19 '21
Web/FrontEnd Interview Questions | JavaScript
r/JavaScriptTips • u/mondersky • Nov 01 '21
share one simple javascript tip you use as an alternative to a longer solution
Did you know you can shorten an array simply by changing its length ?
var a = [ 1 , 2 , 3 ] a.length = 2 // now a is [ 1 , 2 ]
Here's a list of many other interesting tricks 15 Javascript tricks you wish you knew before
r/JavaScriptTips • u/monica_b1998 • Jun 12 '21
Awesome javascript one-liners to look like a pro
r/JavaScriptTips • u/OlanValesco • Jun 24 '19
Use Object.entries() to loop through the the keys and values in an object
This is from ES2017
const users = {
'c1g6hhsus': {name: 'Matthias Broue', dob: '1990-05-04'},
'uhwtpyce2': {name: 'Jenette Vix', dob: '1998-12-01'},
'nvt89pzgx': {name: 'Osman Tragger', dob: '1989-12-26'},
'9gcvl8lbj': {name: 'Tamara Islington', dob: '1993-09-18'},
};
const statements = Object.entries(users).map(([key, val]) => `<li>${val.name}'s user ID is ${key}.</li>`);
document.querySelector('.idStatements').innerHTML = `<ul>${statements.join('')}</ul>`;If you wanted, you could also deconstruct val to just get name out:
const statements = Object.entries(users).map(([key, {name}]) => `<li>${name}'s user ID is ${key}.</li>`);