Try using IIFE to do a complex initialization of a const variable.
<img alt="IFFE for complex initialization" data-cke-saved-src="https://1.bp.blogspot.com/-9WW-Z66fu78/WB-KKBbQ7SI/AAAAAAAACwI/JhwPEgx4L9sF18ypVHBUJSPSY-X4n7DXACLcB/s1600/iife.png" src="https://1.bp.blogspot.com/-9WW-Z66fu78/WB-KKBbQ7SI/AAAAAAAACwI/JhwPEgx4L9sF18ypVHBUJSPSY-X4n7DXACLcB/s1600/iife.png" 523px;="" height:="" 140px;"="" style="float: right; height: 62px; width: 230px;">
IIFE for Complex Initialization
by Bartlomiej Filipek
From the article:
How do you initialize your variables, especially the const ones? What do you do when the code for the initialization is complicated? Do you move it to other method or just write inside the current scope?
Add a Comment
Comments are closed.