Suppose i make a function and have to pass some arguments in it, but instead of passing these local variables, i make them global variables then, what would be it’s advantage or disadvantage??
Scope of variable
hello @Karanveer if the variables are global then you dont need to pass the variables in the function everytime and wherever you are in any function then if you make any change in your that variable then the element orginally there will also get changed or you can say that change will be reflected globally .
1 Like
Thanks for helping…
@Karanveer if you feel that your doubt is cleared them please hit the like button .
and please mark this as resolved.
Happy Learning !!