xxxxxxxxxx
function sleep(num) {
let now = new Date();
const stop = now.getTime() + num;
while(true) {
now = new Date();
if(now.getTime() > stop) return;
}
}
sleep(1000)
console.log('delay 1 second');
xxxxxxxxxx
function stateChange(newState) {
setTimeout(function () {
if (newState == -1) {
alert('VIDEO HAS STOPPED');
}
}, 5000);
}
xxxxxxxxxx
// Pausing execution for 5 seconds
setTimeout(function() {
// Code to be executed after 5 seconds
}, 5000);
xxxxxxxxxx
function waitOneSecond() {
return new Promise(resolve => {
setTimeout(resolve, 1000);
});
}
async function myFunction() {
// Code execution before the delay
await waitOneSecond();
// Code execution after the delay
}
myFunction();
xxxxxxxxxx
// Using plain JavaScript
function wait(seconds) {
const milliseconds = seconds * 1000;
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
async function myFunction() {
console.log("Before waiting");
await wait(5);
console.log("After waiting for 5 seconds");
}
myFunction();
// Using arrow functions and async/await
const wait = seconds => new Promise(resolve => setTimeout(resolve, seconds * 1000));
const myFunction = async () => {
console.log("Before waiting");
await wait(5);
console.log("After waiting for 5 seconds");
};
myFunction();
xxxxxxxxxx
Steps:
Select your data range (including headers).
Go to the Data tab in the Excel ribbon.
Click on Filter.
A drop-down arrow will appear in the headers of your columns.
Click the drop-down arrow in the column where you want to apply the criteria (e.g., Product or Price).
Select your criteria (e.g., filter for a specific value, numbers greater/less than, etc.).
Excel will instantly show only the rows that match your criteria.