Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "questions": [
- {
- "key": "reminder",
- "label": "Choose the time",
- "help": "You can find the stock ticker on the web",
- "required": true,
- "order": 1,
- "controlType": "dropdown",
- "options":[10, 15, 20, 30, 40, 50, 60]
- }
- ],
- //A way to use the JSON file content in the JS
- fetch ("./package.json").then(res => res.json()).then(data => {
- //code with my json file
- });`
- //to display an digital clock
- function JSClock() {
- var temps = new Date();
- var heures = temps.getHours();
- var minutes = temps.getMinutes();
- var secondes = temps.getSeconds();
- var calc = ( "" + (heures > 12) ? heures - 12 : heures);
- if (heures == 0)
- calc = "12";
- calc += ((minutes < 10) ? ":0" : ":") + minutes;
- calc += ((secondes < 10) ? ":0" : ":") + secondes;
- calc += (heures >= 12) ? " P.M." : " A.M.";
- return calc;
- }
- //function which create a countdown timer
- function startTimer(duration, display){
- var timer = duration, minutes, seconds;
- setInterval (function (){
- minutes = parseInt (timer/60, 10)
- seconds = parseInt (timer%60, 10);
- display.textContent = minutes + ":" + seconds;
- if (--timer < 0) {
- timer =duration ;
- }
- }, 1000);
- }
Add Comment
Please, Sign In to add comment