Accessing to attributes via methods in JavaScript

Custom attributes can also be accessed using methods like getAttribute, in which case the full name of the attribute should be written:

html<div id="elem" data-num="1000" data-my-num="2000"></div>
javascriptlet elem = document.querySelector('#elem');

console.log(elem.getAttribute('data-num'));    // shows 1000
console.log(elem.getAttribute('data-my-num')); // shows 2000
Задание 1

Given paragraphs. Go through them in a loop and for each paragraph write down the ordinal number of this paragraph into the data-num attribute. Use the setAttribute method.