Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Ερώτημα 2 begin...
  2. const loadList = (listId, key) => {
  3.     const listValues = localStorage.get(key); //Reads from local storage
  4.     const list = []; //list array
  5.     //Converts json array to object & creates <li> elements with values & listId
  6.     const jsonList = listValues.map( (listItem) => {
  7.     list.push({
  8.         id: listId,
  9.         value: `<li>${listItem.value}</li>` // ES6 Template literal
  10.     });
  11.     });
  12.  
  13.     return list;
  14. };
  15. Ερώτημα 2 end...
  16.  
  17. Erotima 3 begin...
  18. //Pou periexete h tetragonikh riza tou arithmou tou kathe element???
  19. const sqrtTooltip = (className) => {
  20.     const targetElems = document.getElementsByClassName(className);
  21.     let numValue = 0;
  22.     for (i = 0; i < targetElems.length; i++) {
  23.         numValue = targetElem[i].getAttribute('sqrtNumValue');
  24.         targetElem[i].setAttribute('title', Math.sqrt(numValue));
  25.     }
  26. };
  27. Erotima 3 end...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement