question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix `Uncaught TypeError: (intermediate value).now is not a function` on clock.getDelta()

See original GitHub issue

It seems like there is something wrong with the clock now.

On my FPS game, my clock.getDelta() works just fine on my animated character.

But on another page, running clock.getDelta returns:

Uncaught TypeError: (intermediate value).now is not a function

I copied the exact code from the other page, still does it.

I event did a shift+reload on my working page to make sure any changes from the three.js library were synced.

It still works on that page.

I clicked the link on the error which brought me to the debug tab in Firefox.

It seems what you’re doing though is:

function jc(){return("undefined"==typeof performance?Date:performance).now()}

And the clock.getDelta function is calling that jc function.

What I see is right here:

("undefined"==typeof performance?Date:performance).now()

This is where the error is coming from.

I recommend you fix it with this:

("undefined"==typeof performance.now?Date.now():performance.now())

I made it check for performance.now instead of just performance because it seems performance.now does not exist anymore.

Running this code in my console runs smoothly and free of errors.

Until you fix this bug I will use the custom code I made.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gkjohnsoncommented, Sep 18, 2022

The first thing you do in your code is declare a “performance” function and overwrite the the global field…

Please use the three.js forums for three.js help or StackOverflow for general Javascript help.

0reactions
gkjohnsoncommented, Sep 19, 2022
performance.now = Date.now;

To be clear that is not what I recommend. Please use the forum or stackoverflow if you’d like help on what’s gone wrong with your javascript.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: (intermediate value)(...) is not a function
I was setting state after an if statement in a React useEffect() function when I kept receiving this "... is not a function"...
Read more >
TypeError (intermediate value)(...) is not a function in JS
To solve the error, add a semicolon after the closing curly brace of the function declaration. typeerror intermediate value is not a function....
Read more >
TypeError: (intermediate value).then is not a function - Reddit
I want to create a function that checks if a database exists in mongodb and if not, creates it. But I get this...
Read more >
[Autocomplete] TypeError: (intermediate value ... - GitHub
I am integrating autocomplete component in my website. it is crashing when we type anything in the autocomplete field.
Read more >
Uncaught TypeError: (intermediate value)(...) is not a function
JavaScript : Uncaught TypeError : ( intermediate value )(...) is not a function [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found