r/JavaScriptTips • • 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 ?

Post image
5 Upvotes

r/JavaScriptTips • • Jul 18 '22

Beginning with coding again

5 Upvotes

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 • • Jun 13 '22

useWindowSize Hook | Custom hooks | React Js

5 Upvotes

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 • • 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 ?

Thumbnail
gallery
5 Upvotes

r/JavaScriptTips • • May 21 '22

Trying to learn switch statement, having issue with rational operators

5 Upvotes

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 • • May 18 '22

Dark and light theme using HTML, CSS and JavaScript

Thumbnail
youtu.be
5 Upvotes

r/JavaScriptTips • • May 11 '22

Best ways to learn Python

Post image
5 Upvotes

r/JavaScriptTips • • May 02 '22

How to Code a Daft Punk song with HTML, CSS, & Vanilla Javascript(Tutorial)!

Thumbnail
youtube.com
5 Upvotes

r/JavaScriptTips • • Apr 29 '22

I Coded a Vanilla JavaScript Project just to play this SONG!

Thumbnail
youtube.com
5 Upvotes

r/JavaScriptTips • • Apr 23 '22

17 major React JS Interview questions

5 Upvotes

Here are 17 major react js interview questions that I have been asked during all my interviews yet under 5 minutes.
Link: https://www.youtube.com/watch?v=MzU_Fv2aj_g


r/JavaScriptTips • • Apr 19 '22

Understand JavaScript Void

5 Upvotes

💡 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 • • Mar 30 '22

3d popup card (image) using html and css only |

Thumbnail
youtu.be
5 Upvotes

r/JavaScriptTips • • Mar 17 '22

Why Did And Don’t You Need To Import React

Thumbnail
chakshunyu.com
5 Upvotes

r/JavaScriptTips • • Mar 07 '22

VS Code extension helpful for web development

5 Upvotes

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

https://farhan-tanvir.medium.com/10-useful-vs-code-extensions-to-make-life-easier-part-2-a295609788e0


r/JavaScriptTips • • Feb 12 '22

Please Can you help me with this Vue3!!!

Thumbnail
gallery
5 Upvotes

r/JavaScriptTips • • Jan 20 '22

Am I still old-schooled?

5 Upvotes

Am I still old-schooled? I still use JQuery... It's been a lot that I've been using it. A lot.


r/JavaScriptTips • • Dec 21 '21

Learn Intersection Observer In 15 Minutes (from Web Dev Simplified's Youtube channel)

Thumbnail selftaught.dev
5 Upvotes

r/JavaScriptTips • • Nov 22 '21

🎉Daily Javascript Tip: How to convert document nodelist to an array

5 Upvotes

Did you know? You can use all array prototype by converting DOM NodeList to an array.


r/JavaScriptTips • • Oct 06 '21

Flattening an Object/Array in JS, why is it so hard vs PHP. Any tips?

5 Upvotes

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 • • Sep 28 '21

Pure vs Impure functions

5 Upvotes

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) // 5

Impure 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.29203653335571

https://karthickragavendran.medium.com/pure-functions-why-c925c55347b8


r/JavaScriptTips • • Aug 09 '21

Console.log() - The Right Way ✅

Thumbnail
ooshimus.com
5 Upvotes

r/JavaScriptTips • • Aug 07 '21

JavaScript For Loop and While Loop

Thumbnail
youtube.com
5 Upvotes

r/JavaScriptTips • • Jul 19 '21

JavaScript Tutorial for Beginners | JavaScript Arrays explained (#5)

Thumbnail
youtube.com
5 Upvotes

r/JavaScriptTips • • Jul 11 '21

4 Ways To Write For Loops in JavaScript

Thumbnail
medium.com
5 Upvotes