me@helium 8 lat temu
rodzic
commit
3995d32f5b

+ 1 - 1
07ObjectsFunctionalStyle.md

@@ -103,7 +103,7 @@ function Person(name, surname){
 
     this.setAge = function(newAge){
         newAge = +newAge
-        if (!isNaN(newAge) && Number.isInteger(+newAge) && (newAge > 0) && (newAge < 100)){
+        if (!isNaN(newAge) && Number.isInteger(newAge) && (newAge > 0) && (newAge < 100)){
             age = newAge
         }
 

+ 8 - 0
07ObjectsFunctionalStyleHomeWork.md

@@ -21,8 +21,16 @@
 var father   = new Person("Ivan", "Petrov", 50, "male", 100500, true)
 var daughter = new Person("Maria", "Petrova", 25, "female", 500, false)
 
+
+var father2  = new Person("iPhone", "Sedmoy", 45, "male", 500, true)
+var son2     = new Person("Ivan", "Sedmoy", 20, "female", 200, false)
+
 daughter.setFather(father)
 daughter.getFatherName() // => "Ivanovna"
+
+son.setFather(father2)
+son.getFatherName() // => "iPhoneovich"
+
 ```
 
 ### addChild