Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Javascript Articles - Page 362 of 534
233 Views
The promise.finally() calls the callback function whether a promise has been fulfilled or rejected. This helps us to do something once the promise has been rejected or resolved.Following is the code for Promise.finally() in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } Promise.finally in JavaScript CLICK HERE Click on the above button to know when the promise finishes let btnEle = ... Read More
212 Views
With JavaScript, you can group s part of regular expression. This can be done by encapsulating characters in parentheses.Following is an example −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample, .result { font-size: 20px; font-weight: 500; } Named capture groups Regular Expressions The year in which i passed school was 2012. CLICK HERE Click on the above button to extract the year using named groups let sampleEle = ... Read More
186 Views
Lookbehind allows matching a pattern only if there’re something before.Following is an example −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample, .result { font-size: 20px; font-weight: 500; } Look behind Assertions Regular Expressions The price for 4 tables are $50 , $99 , $121 and $150. CLICK HERE Click on the above button to extract the table price using lookbehind let sampleEle = document.querySelector(".sample").innerHTML; let btnEle = document.querySelector(".btn"); let resEle = document.querySelector(".result"); const priceRegex=/(? { resEle.innerHTML = "Table price are = "+sampleEle.match(priceRegex); }); OutputThe above code will produce the following output −On clicking the ‘CLICK HERE’ button −
238 Views
The Unicode property escapes regular expressions, allow us to match characters based on their Unicode properties by using the flag u.ExampleFollowing is an example − Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample, .result { font-size: 20px; font-weight: 500; } Unicode Property Escapes JavaScript Regular Expressions Hello 😆😀 World 🙂😊 CLICK HERE Click on the above button to extract the emojis using regex let sampleEle = document.querySelector(".sample").innerHTML; let btnEle ... Read More
447 Views
For this, use preventDefault() in JavaScript. Following is the JavaScript code −Example Live Demo Document Press Me to see logs Press Me to see logs in console Nothing will happen $(function(){ $("a:not([href='#'])").click(function(event){ event.preventDefault(); console.log("You have pressed me!!!!!"); }); }); To run the above program, save the file name anyName.html(index.html) and right click on the file. Select the option Open with live server in VS code editor.OutputIf you click the two links, Press Me ... Read More
370 Views
For this, you need to use keyDown as well as preventDefault(). Following is the JavaScript code −Example Live Demo Document const pressEnter = (event) => { if (event.key === "Enter") { event.preventDefault(); } }; document.getElementById("disableDefaultTime").addEventListener("keydown", pressEnter); To run the above program , just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VSCode editor.OutputFollowing is the output. When you press Enter key nothing will be displayed.You need to use keyDown to get time as in the below screenshot −
14K+ Views
In order to disable future dates, you need to use maxDate and set the current date. Following is the JavaScript code −Example Live Demo Document The selected date is as follows: $(document).ready(function () { var currentDate = new Date(); $('.disableFuturedate').datepicker({ format: 'dd/mm/yyyy', autoclose:true, endDate: "currentDate", maxDate: currentDate }).on('changeDate', function (ev) { $(this).datepicker('hide'); }); $('.disableFuturedate').keyup(function () { ... Read More
370 Views
Behavior driven framework takes the inputs from all the stakeholders in the project like the developers, testers, product owners, managers, customers and business analysts. The idea is to bring each of the members of the project in the same understanding.Behavior driven framework works on collaboration and coordination among everyone in the team. Technical coding knowledge is not necessary since the functional requirements or specifications are described in non – technical, common language.This specification can be used as a standard template for the testers while designing the test cases by both automation and manual testers. Test coverage for each business scenario ... Read More
1K+ Views
The differences between Data Driven and Keyword Driven framework are described below.In data driven testing, we can run our tests on multiple data in multiple combinations with the help of parameterization. Here the data is treated as an input to the test script logic. Each data set can be treated as a separate test case.In keyword driven testing, the keywords that are developed represent an action. A list of keywords maintained in sequence form a test case. Thus a keyword once developed can be used in multiple test scripts.The data driven framework revolves around the data (maintained in excel, csv ... Read More
387 Views
Keyword driven framework is also known as table driven framework. Here we have a table where we describe the keywords or actions for the methods that have to be executed.Automation test scripts are developed based on the keywords or actions mentioned in excel. The automation testers need to extend the framework capabilities by updating or building newer keywords.People working on manual testing with lesser programming knowledge can use this framework. The main idea is to identify the keywords or actions and utilize them in excel maintained for that particular test scenario. Often this excel sheet becomes a substitute for a ... Read More