Guest User

Untitled

a guest
Nov 15th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. "questions": [
  2. {
  3. "key": "reminder",
  4. "label": "Choose the time",
  5. "help": "You can find the stock ticker on the web",
  6. "required": true,
  7. "order": 1,
  8. "controlType": "dropdown",
  9. "options":[10, 15, 20, 30, 40, 50, 60]
  10. }
  11. ],
  12.  
  13. //A way to use the JSON file content in the JS
  14. fetch ("./package.json").then(res => res.json()).then(data => {
  15. //code with my json file
  16.  
  17.  
  18. });`
  19.  
  20. //to display an digital clock
  21. function JSClock() {
  22. var temps = new Date();
  23. var heures = temps.getHours();
  24. var minutes = temps.getMinutes();
  25. var secondes = temps.getSeconds();
  26. var calc = ( "" + (heures > 12) ? heures - 12 : heures);
  27. if (heures == 0)
  28. calc = "12";
  29. calc += ((minutes < 10) ? ":0" : ":") + minutes;
  30. calc += ((secondes < 10) ? ":0" : ":") + secondes;
  31. calc += (heures >= 12) ? " P.M." : " A.M.";
  32. return calc;
  33. }
  34.  
  35.  
  36. //function which create a countdown timer
  37. function startTimer(duration, display){
  38. var timer = duration, minutes, seconds;
  39. setInterval (function (){
  40. minutes = parseInt (timer/60, 10)
  41. seconds = parseInt (timer%60, 10);
  42.  
  43. display.textContent = minutes + ":" + seconds;
  44.  
  45. if (--timer < 0) {
  46. timer =duration ;
  47. }
  48. }, 1000);
  49.  
  50. }
Add Comment
Please, Sign In to add comment