USE BIND() FUNCTION IN JAVASCRIPT
- Bind () is a function in JS that return another function .that returned function is called 'bound function'.
- when a perticular function needs to be called we use bind()
Syntax with example BELOW ...
EX #2
Notice what happened without call , bind and with call bind
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::Without call / bind :::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Result will looks like ...
Yes it will display global variable Toyota & not Nissan
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::With call / bind :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
*add call & bind to execution call...
Now result will be...
it will invoke vehicle name inside the vehicle object and display 'Nissan'
we used both call and bind at the same time.so nissan will be displayed 2 times (Notice '2' in far right side )
Thank you guys.....................
hope you lerned something new
best of luck......




Comments
Post a Comment