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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:41:09+00:00 2026-06-02T06:41:09+00:00

I want to record the time between each keystroke (just one key to start

  • 0

I want to record the time between each keystroke (just one key to start with, the ‘A’ key) in millseconds.
After the user finishes his thing he can submit and check out the timings between each key stroke. Like:

1: 500
2: 300
3: 400
4: 500
5: 100
6: 50
7: 50
8: 25

I believe this is possible with Javascript, is it?

  • 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-02T06:41:12+00:00Added an answer on June 2, 2026 at 6:41 am

    Sure:

    var times = [];
    
    // add an object with keycode and timestamp
    $(document).keyup(function(evt) {
        times.push({"timestamp":evt.timeStamp,
                    "keycode":evt.which})
    });
    
    // call this to get the string
    function reportTimes() {
        var reportString = "";
        for(var i = 0; i < times.length - 1; ++i) {
             reportString += (i+1) + ": " + (times[i+1].timestamp - times[i].timestamp) + " ";
        }
        return reportString; // add this somewhere or alert it
    }
    

    I added the keycode just in case you wanted it later; it’s not necessary for your exact problem statement.


    Clarification from comments discussion:

    The for loop only goes to up to times.length - 2 (since i is always strictly less than times.length - 1), so there is no issue about times[i+1] being outside the bounds of the array. For example, if you do five key presses and therefore have a times array with five elements (indexed from 0 to 4):

    1st pass: times[1].timestamp - times[0].timestamp
    2nd pass: times[2].timestamp - times[1].timestamp
    3rd pass: times[3].timestamp - times[2].timestamp
    4th pass: times[4].timestamp - times[3].timestamp
    

    Then the loop terminates, because setting i to 4 triggers the termination condition:

    = i < times.length - 1
    = 4 < 5 - 1
    = 4 < 4
    = false  [i cannot be set to 4 by this loop]
    

    Thus, times[i+1] is always a validly indexed element, because i is at most one less than the maximum index.

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

Sidebar

Related Questions

I want to record my most recent cd across any one of my terminals.
I have two tables, each one has a primary ID column as key. I
Using MS Access database I want to display today record min (time) and previous
I am doing a performance comparison test. I want to record the run time
What i want to do is record the time of when a button has
I want to understand the relationship between a record being created in the users
I want to record what various sources have to say about a historical figure.
i want to record my app in ipad is there any esay way to
I am developing an application in which I want to record the sound of
For a game server, I want to record details when a player makes a

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.