Skip to main content

Posts

Showing posts with the label js

Mastering React and Redux Chapter 1

  Mastering React and Redux Chapter 1 React and Redux are two popular JavaScript libraries that are widely used in building web applications today. Both libraries are maintained by Facebook, and they work together seamlessly to provide an efficient and scalable solution for managing the state of an application. In this blog post, we will take a closer look at how React and Redux work together, and how they can be used to build robust and performant web applications. React, often referred to as React.js or ReactJS, is a JavaScript library that is used to build user interfaces. It is a component-based library, which means that an application is built using small, reusable components. Each component is responsible for rendering a specific part of the user interface, and they can be easily composed to create complex applications. One of the key advantages of React is its use of a virtual DOM (Document Object Model). This allows React to efficiently update the user interface when the un...

SOLUTION- The term 'create-react-app' is not recognized as the name of a cmdlet

Solution for create-react-app : The term 'create-react-app' is not recognized as the name of a cmdlet, function, script file,or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Sometimes when we try to run ' create-react-app yourappname' we get an error like "... create react-app is not recognized" To solve this issue , Please follow below steps 1. Use npx Try to run command like below.  npx create-react-app yourappname OR npx create-react-app yourappname --use-npm 2. Add NPM Path to windows Path manager(WINDOWS SOLUTION) Go to Environment Variables > Path  and add npm path there. You can follow below steps:- Then check npm path in your system and click on new and paste npm location there. Now try again, it will work :)

How to generate a valid random mail using Jquery Javascript?

How to generate a valid random mail using Jquery or Javascript In this tutorial we will learn how to generate a random unique email address using Pure Javascript. Use below code it will return a function generateEmail() { var allchars = 'abcdefghijklmnopqrstuvwxyz1234567890'; var emailLength = 15; var string = ''; for(var i=0; i<emailLength; i++){     string += allchars[Math.floor(Math.random() * allchars.length)]; } string = string + '@gmail.com'; return string; } var newEmail = generateEmail(); alert(newEmail); Code Explain: We have created "allchars" variable that contains all possible characters that our function will use, if you want to remove numbers from it or add capital letters , you can edit this string. Then we have defined "emailLength" variable , You can change length of email according tou your requirement. Then we are looping until the length and generating random string using Math functions. Finally we are adding postfix em...

JS HTML REGEX Phone number validation allow 10 digits only

JS jQuery Phone number validation allow 10 digits only If you want to validate an input field where user can input only 10 digits and allow only numeric values then use below code Solutions:- 1) jQuery Allow number upto 10 digits jQuery("#pval").on("keypress keyup blur",function (e) { var thisvallen = jQuery(this).val();    jQuery(this).val(jQuery(this).val().replace(/[^0-9\.]/g,''));       if ((e.which != 46 || jQuery(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {           event.preventDefault();       }         if((thisvallen).length > 10) {             jQuery(this).val((jQuery(this).val()).substr(0,10));             event.preventDefault();         } }); 2) Validate Phone number using JS...