r/JavaScriptTips • • Aug 05 '23

how can i associate each button to each string in the array so when i click button 1 scring 0 appeare in the alert

0 Upvotes

window.onload = function() {

var btn = document.querySelectorAll("button");

var taxt = ["woui" , "wowo" , "wiwo" , "wawa"]

for(var b = 0; b < 3 ; b++ ) {

btn[b].addEventListener("click" ,ddo ) ;

} ;

function ddo () {

alert(taxt[b])

}


r/JavaScriptTips • • May 04 '24

Seeking Guidance for My JavaScript Learning Journey

0 Upvotes

Hey everyone,

I've started creating JavaScript tutorials on YouTube and I'm excited to dive deeper into this fascinating language. JavaScript, originally known as Mocha, has come a long way since its inception in 1995 by Brendan Eich at Netscape Communications Corporation.

Currently, I'm covering fundamentals like keywords, variables, and the nuances between let and var. But I'm here to ask for your help! Do you have any tips, resources, or suggestions to enhance my learning journey?

Looking forward to your insights!

https://youtu.be/OOM7WZE9dXE


r/JavaScriptTips • • Dec 28 '22

Would you suggest web development to someone willing to self study? Why and why not?

0 Upvotes

If someone with no background in tech and wants to break into tech.

Would you recommend web development or another field?


r/JavaScriptTips • • Sep 20 '24

How can I check two json with condition is key and value must same in others ,not need same with 100 just need check contains and same

0 Upvotes

r/JavaScriptTips • • Jun 21 '23

JAva script bypass school points

0 Upvotes

hello, my points program for school is made with java script, last year I could see my points before they became public. This year I can't, anyone who could help me bypass this program?


r/JavaScriptTips • • Oct 18 '23

Switch Statement in JavaScript | Use, Example - Scientech Easy

Thumbnail
scientecheasy.com
0 Upvotes

r/JavaScriptTips • • Jul 09 '23

Is string/number also an object in JavaScript?

Thumbnail
youtube.com
0 Upvotes

r/JavaScriptTips • • Jun 23 '23

Building Beautiful Login Pages with Auth0

0 Upvotes

Learn how to create customizable and secure login pages that match your branding to enhance user experience and conversion rates.

Read more…


r/JavaScriptTips • • Jun 23 '23

How to Apply Class Name with conditions in React JS

0 Upvotes

To implement conditional classnames in ReactJS, developers typically rely on conditional statements, such as if-else or ternary operators, to determine which class names should be applied. Here's a simple example that demonstrates how conditional classnames can be used in a React component:

import React from 'react';
import './Button.css';

const Button = ({ isPrimary }) => {
  const buttonClass = isPrimary ? 'primary' : 'secondary';

  return (
    <button className={`button ${buttonClass}`}>
      {isPrimary ? 'Primary Button' : 'Secondary Button'}
    </button>
  );
};

export default Button;

In the example above, the Button component receives a prop called isPrimary
which determines whether the button should have a primary or secondary style. By using a conditional statement, the buttonClass variable is assigned either the value 'primary' or 'secondary'. These values are then interpolated within the className attribute of the button element. In this case, the CSS class names used are 'button', 'primary', and 'secondary'. By combining them dynamically using template literals, the appropriate class name is applied to the button element based on the value of isPrimary.

By utilizing conditional statements, developers can easily toggle class names based on specific conditions, enabling the creation of interactive components that adapt to user interactions and application state. With the support of libraries and utilities, working with conditional classnames becomes even more efficient and maintainable.

Learn >> Step by Step explanation to applying condition classname


r/JavaScriptTips • • Sep 22 '24

Does anyone know how I can get the asset path to lead to all of these? Sorry if this is a stupid question I'm new to coding.

Thumbnail
gallery
0 Upvotes

r/JavaScriptTips • • Jul 24 '23

Understanding LET vs CONST in Javascript #SHORTS #youtubeshorts #trendin...

Thumbnail
youtube.com
0 Upvotes

r/JavaScriptTips • • Jun 07 '24

DOM Manipulation in JS

0 Upvotes

What is the DOM?

The DOM is the structure of a webpage. It's like a tree, with each element on the page being a part of the tree. By working with the DOM, we can change the content, style, and behavior of the webpage using JavaScript.

How Can We Change the Web Page to Look and Work How We Want?

  • Selecting Elements: This is where we target the specific node we want to work with. We can use various methods like getElementById for unique elements or getElementsByTagName to grab all elements of a specific tag type.

  • Modifying Content: Once we have our element, we can change its inner text using innerHTML or specific properties like .textContent. This lets us update information dynamically, like refreshing a live score or displaying user-generated content.

  • Style Tweaks: The DOM isn't just about text; we can also control the look and feel. Using the .style property, we can change element colors, fonts, and even add animations to create a more engaging experience.

  • Adding and Removing Elements: Want to create a dynamic list that populates as users add items? Or maybe you need to remove an element after a certain action? DOM manipulation allows us to do both. We can use methods like createElement and appendChild to insert new nodes into the tree, and removeChild to take them out.

Here are some of the cool things you can achieve with DOM mastery:

  • Create interactive forms that validate user input.

  • Build dynamic menus that change based on user actions.

  • Implement real-time features like chat applications or live tickers.

  • Craft stunning visual effects and animations.


r/JavaScriptTips • • Aug 07 '23

8 unique projects to master Vanilla JavaScript

Thumbnail
youtube.com
0 Upvotes

r/JavaScriptTips • • Sep 25 '23

How to deep clone a nested object without using libraries (JavaScript Interview question)

Thumbnail
youtube.com
0 Upvotes

r/JavaScriptTips • • Jan 04 '23

Cloud IDE tips?

0 Upvotes

These online editors, is there one where we can expose only parts of our codebase but still give the ability of running the project. Ie all the env variables are set, but depending on authorisation the user can't see them?


r/JavaScriptTips • • Jun 29 '23

Java vs JavaScript

Thumbnail
technource.com
0 Upvotes

r/JavaScriptTips • • Jul 08 '23

isPrime is here...

0 Upvotes

Hello fellow developers! We are excited to inform you that a new function, `isPrime`, has been added to our repository of one-line JavaScript utility codes. This function can be used to determine whether a given number is prime or not.

The `isPrime` function takes a number as input and performs a series of checks to determine its primality. It considers numbers greater than 1 and checks if they are divisible by any numbers in the range from 2 to the square root of the given number. Employing this efficient algorithm, it provides accurate results for prime number identification.

Feel free to explore the repository and make use of this handy function in your JavaScript projects. We encourage you to contribute, share your feedback, and suggest enhancements to the repository to further enrich our community-driven collection of one-line JavaScript utility codes.

Join us today and let's empower each other with our coding prowess!

Repository Link: one-line-javascript-utility-codes


r/JavaScriptTips • • Apr 17 '23

Help

Post image
0 Upvotes

I’m working on a sample problem for ATA and I keep getting an “illegal parenthesized expression” error. Can someone tell me what I’m doing wrong and how can I fix it?


r/JavaScriptTips • • Feb 21 '23

Add key dynamically to an object. JavaScript interview questions #39 subscribe for more

Thumbnail
youtube.com
0 Upvotes

r/JavaScriptTips • • Jun 26 '23

How to Moving an Elements in JavaScript

0 Upvotes

Moving Elements in JavaScript means automatically changing the position of an element without any interaction. We can move the element by using both CSS and Javascript.  If you want to move an HTML element in javascript, we need to create setInterval function and use the "left" property inside it. You can execute a function repeatedly at a specific time interval by creating the setInterval function. So, in this article, we will see how to move elements in Javascript.

JS:

 	var x =0
	window.onload = function(){
		var box = document.getElementById("box")
		setInterval(function(){
			x++
			box.style.left=x + 'p'
		},10)
	}

Click here to see : 3 Steps to moving element


r/JavaScriptTips • • Mar 02 '23

What is JavaScript in under 30 Seconds 🔥🔥🔥

Thumbnail
youtube.com
0 Upvotes

r/JavaScriptTips • • Nov 16 '23

More than 500 Javascript tips

0 Upvotes

r/JavaScriptTips • • Jul 29 '24

How to Send HTTP Requests Using JavaScript

Thumbnail
thedevspace.io
0 Upvotes

r/JavaScriptTips • • Jan 18 '23

CodeHS - 2.9.8 Stop Light

Thumbnail self.learnjavascript
0 Upvotes