|
@@ -1,32 +1,29 @@
|
|
|
-//task1
|
|
|
-function sampleFunc1 () {
|
|
|
- console.log ( `${arguments.callee.name}: ${arguments[0]} | ${arguments[1]}` )
|
|
|
+//task 1
|
|
|
+let body = document.body;
|
|
|
+let tags = ["p","div","h1"]
|
|
|
+let classes =["c1","c2","c3"]
|
|
|
+let lennn = classes.length;
|
|
|
+for ( i = 0; i < tags.length; i++) {
|
|
|
+ tags[i]=document.createElement(tags[i])
|
|
|
+ tags[i].className = classes[i%lennn]
|
|
|
+ body.appendChild(tags[i])
|
|
|
+ tags[i].innerText ="love it"
|
|
|
}
|
|
|
|
|
|
-function modificator1 ( func ) {
|
|
|
- return func.bind(null, 'test', 'sample')
|
|
|
-}
|
|
|
-
|
|
|
-testFunc1 = modificator1( sampleFunc1 )
|
|
|
-
|
|
|
-testFunc1()
|
|
|
-
|
|
|
-
|
|
|
|
|
|
//task2
|
|
|
-function sampleFunc () {
|
|
|
- console.info (`Symbols in my code: ${arguments.callee - 0}`)
|
|
|
+let task= {
|
|
|
+ tagsArray:[
|
|
|
+ {name: "button", class: "btn1"},
|
|
|
+ ]
|
|
|
}
|
|
|
-
|
|
|
-function modificator(func) {
|
|
|
- func.valueOf = function () {
|
|
|
- return this.toString().length;
|
|
|
- };
|
|
|
+for(let i=0; i < task.tagsArray.length; i++) {
|
|
|
+ let arrItems= task.tagsArray[i]
|
|
|
+ arrItems.name= document.createElement(arrItems.name)
|
|
|
+ arrItems.name.id = arrItems.class
|
|
|
+ body.appendChild(arrItems.name)
|
|
|
+ arrItems.name.innerText="donate me"
|
|
|
}
|
|
|
-modificator( sampleFunc )
|
|
|
-
|
|
|
-sampleFunc()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-//task3
|
|
|
+document.getElementById("btn1").addEventListener("click", function() {
|
|
|
+ alert("ty but ochen' malo")
|
|
|
+});
|