+ 1

Please why can't I call person() in line 19 of the code named remove inner object

An unknown function they say it is but I tried it in the other code named global variable accessed from inside and it worked https://code.sololearn.com/WYhL5awtmEuj/?ref=app https://code.sololearn.com/W9NqzL3q1xWp/?ref=app

13th Apr 2022, 1:28 PM
steve Purpose
steve  Purpose - avatar
10 ответов
+ 2
Can you describe to me, what was your actual intention with this code? cause I'm not getting any ideas ... I mean, what you want the code to do, briefly.
13th Apr 2022, 1:56 PM
Ipang
+ 3
Yes I see, but in "Global variable" code, the `Drive` function does not construct an object, neither does it return an object with attributes or methods, the way `person` function does ... `Drive` simply log value of <Break> variable which resides outside the function, much simpler one by functionality I guess, compared to `person`.
13th Apr 2022, 3:04 PM
Ipang
+ 2
Sorry, did you mean to call `person()` just like that, but what was the point for calling just `person()` Where you learn this, in SoloLearn? other place? I'd like to see it so I can understand the actual intention of the code better.
13th Apr 2022, 2:22 PM
Ipang
+ 2
No problem bro 👌
13th Apr 2022, 4:11 PM
Ipang
+ 1
Thanks for the explanation..I appreciate
13th Apr 2022, 4:11 PM
steve Purpose
steve  Purpose - avatar
+ 1
Thanks all for the answer on the code I named return inner object..Went back to go do some research and found out it was an IIFE, immediately invoked function expression used in the modular pattern of encapsulation in OOP Javascript.
15th Apr 2022, 3:06 PM
steve Purpose
steve  Purpose - avatar
0
Ok I was studying encapsulation and copied it..What I want to know is about the function call on line 19. Why is it that if I type person() it gives an error ?.
13th Apr 2022, 2:00 PM
steve Purpose
steve  Purpose - avatar
0
Ok try accessing the code I named Global variable accesed from inside to understand what I'm saying.
13th Apr 2022, 2:42 PM
steve Purpose
steve  Purpose - avatar
0
It is basically data validation code .I was just wondering why I can't type person().if I type person() it returns error, but did it in the code named Global variable accessed from inside and it worked https://code.sololearn.com/W9NqzL3q1xWp/?ref=app
13th Apr 2022, 2:51 PM
steve Purpose
steve  Purpose - avatar
0
Thanks
13th Apr 2022, 4:09 PM
steve Purpose
steve  Purpose - avatar