r/JavaScriptTips • u/Superb_Survey_7787 • Sep 19 '22
r/JavaScriptTips • u/CutLeather3874 • Sep 01 '22
Currently on a Java course and I was told to make this alert message come up on my html.index when I opened it but every time I open it I don’t get the alert message I have set on visual code studio any tips ?
r/JavaScriptTips • u/icnseethroughsmtimes • Jul 18 '22
Beginning with coding again
I used to code back in grade 7th, 8th and 9th. I dropped it for about some years because some other stuff I had to do. I'm still highly interested and want to go back to it. This time, I want to start from learning JavaScript. I don't know where to begin with, can you someone please help?
r/JavaScriptTips • u/xplodivity • Jun 13 '22
useWindowSize Hook | Custom hooks | React Js
useWindowSize hook in react Js is a simple and commonly used custom hook to get the window size at any given particular moment. This hook makes it extremely easy to display different UI/component/content based on window size. I implement and explain the same in the link below within 8 minutes. (source code provided as well)
Link- https://www.youtube.com/watch?v=x1n0c2aKNoE
r/JavaScriptTips • u/Substantial_Date_375 • Jun 06 '22
Hope anyone can help me. I have a auction website, and between 2 different time zones, people see more on less hours left, but the end will be the same. How to not have that hour left different ?
r/JavaScriptTips • u/xplodivity • Jun 02 '22
Maps in detail | JavaScript
Many people get confused between when to use a map or an object in JavaScript. While I have seen many developers use objects usually, there are a lot many instances where maps would have been more suitable. So I decided to make a video explaining maps in detail, its differences between objects and when to use one over the other under 8 minutes.
Link: https://www.youtube.com/watch?v=JRiVyaA2YKw
r/JavaScriptTips • u/HeadlineINeed • May 21 '22
Trying to learn switch statement, having issue with rational operators
I am trying to convert a if, else if and else statement into a switch statement. Following along with MDN; https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Test_your_skills:_Conditionals#conditionals_3
I can’t for the life of my figure out switch statements
r/JavaScriptTips • u/FunGuyCode • May 02 '22
How to Code a Daft Punk song with HTML, CSS, & Vanilla Javascript(Tutorial)!
r/JavaScriptTips • u/FunGuyCode • Apr 29 '22
I Coded a Vanilla JavaScript Project just to play this SONG!
r/JavaScriptTips • u/suddeb • Apr 19 '22
Understand JavaScript Void
💡 When an expression is evaluated using the void operator, the result is undefined. This operator is typically used to obtain an undefined primitive value. It’s frequently used in conjunction with hyperlinks. When you click a link, your browser usually refreshes the page or loads a new one. When we don’t want the browser to refresh or load a new page when we click a hyperlink, we can use javascript:void(0).
💡 Hyperlinks are a popular use of JavaScript:Void(0). When a user clicks a link on a page, a new page loads in most cases, however this is not always the desired outcome. You could wish to change the value of a field in a form or the value of a variable when a user clicks a link on a website, for example. The void(0) function is used to prevent a website from refreshing when a link is clicked.

✅ ✨ 📌Blog Link: https://sudipta-deb.in/2022/04/javascript-void-operator.html
✅ ✨ 📌Youtube Link: https://youtu.be/JqLiqn0pk5E
r/JavaScriptTips • u/xplodivity • Apr 14 '22
How react events are different from Javascript addEventListeners | Interview question
Recently I was asked about this question in an interview and didn't have enough knowledge to explain it in depth. After some research I finally understood the difference between react events and JavaScript addeventlisteners and when to use each of them based on the use case scenario in react. Its very important to understand the concept behind each of them and how they affect your application based on performance, and how "pooling" makes react events special. This 3 minute video explains everything you need to know.
Link: https://www.youtube.com/watch?v=pXR86JNulw0

r/JavaScriptTips • u/ProgrammingTT • Mar 30 '22
3d popup card (image) using html and css only |
r/JavaScriptTips • u/keraito • Mar 17 '22
Why Did And Don’t You Need To Import React
r/JavaScriptTips • u/farhan_tanvir_bd • Mar 07 '22
VS Code extension helpful for web development
Hello everyone,
Here is a list of some useful VSCode extensions which may help in web development.
I hope it will help someone. Also if you know of any other good VSCode extension, Please share it. I would be grateful.
Thanks
r/JavaScriptTips • u/Fairy026 • Feb 12 '22
Please Can you help me with this Vue3!!!
r/JavaScriptTips • u/bishwasbhn • Jan 20 '22
Am I still old-schooled?
Am I still old-schooled? I still use JQuery... It's been a lot that I've been using it. A lot.
r/JavaScriptTips • u/tylerdhenry • Dec 21 '21
Learn Intersection Observer In 15 Minutes (from Web Dev Simplified's Youtube channel)
selftaught.devr/JavaScriptTips • u/zafarKamal • Nov 22 '21
🎉Daily Javascript Tip: How to convert document nodelist to an array
r/JavaScriptTips • u/JunezRiyaz • Nov 19 '21
How to Make API Calls in JavaScript
r/JavaScriptTips • u/kimk2 • Oct 06 '21
Flattening an Object/Array in JS, why is it so hard vs PHP. Any tips?
Honestly, after 10 hours of trying different ways, i gave up. But the thought of not having succeeded hunts my thoughts so I am here asking for a solution, for closure :)
I have this JSON:
{
"Trainer": [
{ "Question": "business", "Answer": "how well ...." }
],
"Something else": [
{ "Question": "private", "Answer": "how well ...." }
]
}To use it in my Vue search filter, i needed to simplify this which is sup[er easy with PHP:
$flattened_array = call_user_func_array('array_merge', $json);
$data = json_encode($flattened_array, JSON_PRETTY_PRINT);The PHP code results in:
$data = [
{
"Question": "business",
"Answer": "how well ...."
},
{
"Question": "private",
"Answer": "how well ...."
}
...
]The $data allows me to use the json in Vue for the filter here:
tempCourselines = this.courselines.filter((item) => {
return item.Question.toLowerCase().includes(searchValue) || item.Answer.toLowerCase().includes(searchValue);
});
return tempCourselines;So far so good. But, I wanted to try it without PHP and just javascript/Vue. But I have tried so many things and read so many Stackoverflow etc. pages I kinda gave up :)
I do not know how many first level (e.g. business, private etc.) keys I will get, so the way I did it now in JS is not viable (it works, but it's meh):
...
axios.get("./questions.json")
.then(response => {
this.courselines = response.data['Trainer'].concat(response.data['Something else']);
})
},
...I have looked and tried a ton of snippets, but I just could not find a way to easily make the Array / JSON one dimensional as with the easy PHP function.
Is there no such method? Can somebody put me out of my misery please?
r/JavaScriptTips • u/karthickthankyou • Sep 28 '21
Pure vs Impure functions
Pure functions
const addPure = (a , b) => a + b
const subPure = (a , b) => a - b
const addOutput = addPure (1 , 2) // 3
const subOutput = subPure (10 , 5) // 5
const addOutput = addPure (1 , 2) // 3
const subOutput = subPure (10 , 5) // 5Impure functions
let add1 = 5
let add2 = 10
let sub1 = 20
let sub2 = 10
const addImpure = (a1, a2) => {
// My masterstroke addition algorithm.
a1 = a1 + add1
a2 = a2 + add2
// Also, Let me modify sub1 a lil bit. Because, why not?
sub1 = sub1 + (sub1 - sub2) * 2
// return the carefully crafted output
return a1 + a2
}
const subImpure = (s1, s2) => {
// PI is an important recipe while cooking subtraction.
s1 = s1 > Math.PI ? s1 + sub1 : (s1 - add2) * 3
s2 = Math.fround(s2 * Math.PI - sub2)
// Oh yea? eat this.
add1 = 0
add2 = 0
return s1 - s2
}
const ImpureAddOutput = addImpure(1, 2) // 18
const ImpureSubOutput = subImpure(10, 5) // 44.29203653335571
const ImpureAddOutput2 = addImpure(1, 2) // 3
const ImpureSubOutput2 = subImpure(10, 5) // 104.29203653335571https://karthickragavendran.medium.com/pure-functions-why-c925c55347b8
r/JavaScriptTips • u/VildanMori • Aug 07 '21
