Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 01-27-2016, 12:17 AM   #1
Manishkumar12
Registered User
 
Join Date: Dec 2015
Posts: 157
what is bind() method in javascript?

what is bind() method in javascript?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Manishkumar12 is offline   Reply With Quote

Old 01-31-2016, 10:07 PM   #2
hdensr
Registered User
 
Join Date: Jan 2016
Posts: 16
hello friends,
Let's look at a non Javascript example to help understand objects, methods, and propreties. Consider a a pet like a cat or a dog. What are some functions or tasks that a cat object might perform? Cats eat, sleep, scratch, meow, run, hunt, and other things. In Javascript lingo, each of these verbs would be methods of the cat object. These methods would be written as:

cat.eat("cat food")
cat.sleep()
cat.scratch("furniture")
cat.meow()
Notice that methods have parentheses after them and that some methods require information within the parentheses. Informaton within a method's parentheses is known as the method parameter(s). A parameter is just additional information that a method needs to do its job. In the Javascript world the write method of the document object needs to know what to write so the method has a parameter that tells it what to write. Similarly the parameter of the prompt method tells the method what to display in the dialog box.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
hdensr is offline   Reply With Quote
Old 01-31-2016, 11:24 PM   #3
Shivangi Panwar
Registered User
 
Join Date: Nov 2015
Posts: 127
Bind is a method inherited from Function.prototype same like call and apply. It basically helps to bind a function to an object's context during initialization.

See More at krasimirtsonev[dot]com/blog/article/JavaScript-bind-function-setting-a-scope
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Shivangi Panwar is offline   Reply With Quote
Old 02-01-2016, 01:30 AM   #4
Martinricky
Registered User
 
Join Date: Aug 2015
Posts: 434
The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Martinricky is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Implement Interfaces in JavaScript JavaScriptBank Javascript 1 03-30-2014 11:48 PM
Javascript Countdown Timer redirecting Affiliate Links JavaScriptBank Javascript 0 05-20-2013 10:29 PM
40 Super Nice JavaScript Extensions and Plugins JavaScriptBank Javascript 0 04-28-2013 11:14 PM
9 Funniest JavaScript effects JavaScriptBank Javascript 0 04-18-2013 02:13 AM
65 Free JavaScript Photo Gallery Solutions JavaScriptBank Javascript 0 04-15-2013 06:38 PM


All times are GMT -7. The time now is 09:50 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.