This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let inputParam = 'abccbdeedfgg'; | |
| const findRepeatingCharacters = (val) => { | |
| let outputArray = []; | |
| let temp = ''; | |
| for (const element of val) { | |
| if (temp !== '') { | |
| if (temp === element) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getDayDiff(start, end) { | |
| let startDate = new Date(start); | |
| let endDate = new Date(end); | |
| if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) { | |
| throw new Error("Invalid date provided."); | |
| } | |
| let difference = Math.abs(endDate - startDate); | |
| let days = difference / (1000 * 60 * 60 * 24); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Mouse Scroll Event</title> | |
| </head> | |
| <body> | |
| <div style="height: 2000px; padding: 20px;"> | |
| <h1>Scroll the page</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function currying(x){ | |
| return function (y){ | |
| console.log(x+y); | |
| } | |
| } | |
| currying(9)(4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isPrime = (num) => { | |
| if (num <= 1) { | |
| return false; | |
| } | |
| for (let index = 2; index <= Math.sqrt(num); index++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const steps = (timeInSec) => new Promise((resolve, reject) => setTimeout(() => { resolve(); }, timeInSec * 1000)); | |
| async function breakFunction() { | |
| console.log('Initial Logging...'); | |
| await steps(2); | |
| console.log('2 seconds break completed...'); | |
| await steps(3); | |
| console.log('3 seconds break completed...'); | |