Author | Message |
---|---|
wevanw
Posts: 25
|
Posted 17:40 Feb 11, 2017 |
How to give constructor a default value if not specified? |
Dipesh
Posts: 9
|
Posted 17:44 Feb 11, 2017 |
contructor(list = []) so if we don't pass list value, it will consider " []" to default value Thank you |
Amedrano
Posts: 80
|
Posted 17:46 Feb 11, 2017 |
I used (if...else) if constructor was Not given a value give it one else use the one that was given
|
aaleman11
Posts: 42
|
Posted 17:51 Feb 11, 2017 |
^^^ Andrew is correct on this one. |
wevanw
Posts: 25
|
Posted 17:51 Feb 11, 2017 |
Thank you guys! Saved my life...I've been googled for a ling time. Appreciate! |