Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ερώτημα 2 begin...
- const loadList = (listId, key) => {
- const listValues = localStorage.get(key); //Reads from local storage
- const list = []; //list array
- //Converts json array to object & creates <li> elements with values & listId
- const jsonList = listValues.map( (listItem) => {
- list.push({
- id: listId,
- value: `<li>${listItem.value}</li>` // ES6 Template literal
- });
- });
- return list;
- };
- Ερώτημα 2 end...
- Erotima 3 begin...
- //Pou periexete h tetragonikh riza tou arithmou tou kathe element???
- const sqrtTooltip = (className) => {
- const targetElems = document.getElementsByClassName(className);
- let numValue = 0;
- for (i = 0; i < targetElems.length; i++) {
- numValue = targetElem[i].getAttribute('sqrtNumValue');
- targetElem[i].setAttribute('title', Math.sqrt(numValue));
- }
- };
- Erotima 3 end...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement