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 6652681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:10:15+00:00 2026-05-26T01:10:15+00:00

I think this may be a duplicate of Strict Violation using this keyword and

  • 0

I think this may be a duplicate of Strict Violation using this keyword and revealing module pattern

I have this code:

function gotoPage(s){
    if(s<=this.d&&s>0){this.g=s; this.page((s-1)*this.p.size);}
}

function pageChange(event, sorter) {
    var dd = event.currentTarget;
    gotoPage.call(sorter, dd[dd.selectedIndex].value);
}

And JSHINT (JSLINT) is complaining. It says “Strict violation.” for the highlighted line:

enter image description here

Is my use of Function.call() and then referencing the instance, somehow inappropriate?

Is this considered to be bad style?

  • 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-05-26T01:10:15+00:00Added an answer on May 26, 2026 at 1:10 am

    JSHint says “Possible strict violation” because you are using this inside something that, as far as it can tell, is not a method.

    In non-strict mode, calling gotoPage(5) would bind this to the global object (window in the browser). In strict mode, this would be undefined, and you would get in trouble.

    Presumably, you mean to call this function with a bound this context, e.g. gotoPage.bind(myObj)(5) or gotoPage.call(myObj, 5). If so, you can ignore JSHint, as you will not generate any errors. But, it is telling you that your code is unclear to anyone reading it, because using this inside of something that is not obviously a method is quite confusing. It would be better to simply pass the object as a parameter:

    function gotoPage(sorter, s) {
        if (s <= sorter.d && s > 0) {
            sorter.g = s;
    
            sorter.page((s - 1) * sorter.p.size);
        }
    }
    
    function pageChange(event, sorter) {
        var dd = event.currentTarget;
        gotoPage(sorter, dd[dd.selectedIndex].value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Search and replace inside an associative array I think this may have
I think this may be relatively straight forward. I have a rewrite rule that
Hopefully this question isn't as subjective as I think it may be. I have
I realise this may be a duplicate, but I have searched through many forums
I'm slightly worried that this may be a duplicate, but I have searched the
You may think this question is the exact duplicate of Running two projects at
This probably looks like a duplicate but I don't think so. I have already
I think this question may end up being a bit subjective so I'm marking
I am new at JavaScript so I think my problem may be simple. This
I think this is the question, anyway. I am using a RelayCommand, which decorates

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.