Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:28:03+00:00 2026-06-03T15:28:03+00:00

The answers from this question says to use this to check if function is

  • 0

The answers from this question says to use this to check if function is defined:

typeof yourFunction === 'function'

But I’ve tried this on a non-standard function link(). And actually this returned false. The function is available on every browser I’ve tried – IE, Chrome, Opera, FireFox.

typeof String.link === 'function' // false
typeof String.link() === 'function' // Uncaught error ...

Then somewhere I find:

typeof String.prototype.link === 'function' //true

which actually returns true. What is the difference and why the first one fails?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:28:09+00:00Added an answer on June 3, 2026 at 3:28 pm

    String is a constructor function, and functions are also objects. You can append properties to it.

    For example:

    function foo(){
        alert('from foo');
    }
    
    foo.bar = function(){
        alert('bar on foo');
    }
    
    foo();     //from foo
    foo.bar(); //bar on foo
    

    It’s the same reason how jQuery’s $ acts like an object (eg. $.each()) and like a function as well (eg. $(selector)).

    And so:

    • using String.link is accessing a property of the constructor function itself – which does not exist.

    • using String.prototype.link accesses the link() function that comes with every string – which does exist (and which you should use)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a process with administrator privileges. From this question and answers it seems
From the answers to this question it appears there's a file somewhere on our
Using code from the answer to this question I managed to mirror text but
I've seen this question asked 100+ times but none of the answers are working
I know (from the answer to this question: .rar, .zip files MIME Type )
This question is spawned from the partial answer to JSF2: why does empty test
From the content of the answer to this question I learned a new trick;
This question arose from the discussion in the comments of this answer . First,
I have been looking at the answer to this question: Pulling details from response
I am trying to integrated linkedIn using this question answer Posting LinkedIn message from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.