# Did you miss me? I hope you can help me

**URL:** <https://talk.code3dgames.com/t/did-you-miss-me-i-hope-you-can-help-me/297>\
**Category:** Uncategorized\
**Created:** [June 28, 2021, 1:43pm UTC](https://talk.code3dgames.com/t/did-you-miss-me-i-hope-you-can-help-me/297 "2021-06-28T13:43:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/martin/32/41_2.png) [@Martin](https://talk.code3dgames.com/u/Martin)\
**Post date:** [June 28, 2021, 1:43pm UTC](https://talk.code3dgames.com/t/did-you-miss-me-i-hope-you-can-help-me/297/1 "2021-06-28T13:43:32Z")

</div>

So, i i am now at chapter 6 and i am at page 75 and i got errors at the js. Console.  
Console’s output: code.html:124 Uncaught TypeError: Cannot read property ‘GetElapsedTime’ of undefined  
at walk (VM182 code.html:124)  
at animate (VM182 code.html:114)  
and Url of the script is:  
[https://is.gd/PSjTkO](https://is.gd/PSjTkO)  
I very very very hope you can help me (again) 😀 🥰

---

<div class="post-metadata">

**Author:** ![chris](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/chris/32/5_2.png) [@chris](https://talk.code3dgames.com/u/chris)\
**Post date:** [June 28, 2021, 2:11pm UTC](https://talk.code3dgames.com/t/did-you-miss-me-i-hope-you-can-help-me/297/2 "2021-06-28T14:11:07Z")

</div>

Yup. That was a tough one. Even people that have been doing JavaScript for years run into problems like this all the time.

To fix, delete the code on lines 92-97. That is, delete the following:

```javascript
function animate() {
  requestAnimationFrame(animate);
  acrobatics();
  renderer.render(scene, camera);
}
animate();

```

The short explanation is that there are two different `animate()` functions (and calls) and the first one is not needed.

The long explanation is trouble starts on the last line, the call to the `animate()` function. It’s _not_ calling the `animate()` function that starts on line 92. Instead, it’s calling the `animate()` function that is defined later in the code. When `animate()` is called on line 97, it is _before_ the `clock` variable is defined. When the second `animate()` function tries to run, it ask the `clock` variable to return the elapsed time. But `clock` is not yet defined, so we get an error. And, since `animate()` is called several times a second, you get LOTS of those errors.

Sorry for the delay in getting back to you. I’m almost positive you would have found this on your own, but just so you don’t have to wait in case you can’t, there’s another bug in that code that was being “hidden” by the above problem. In the `walk()` function, the “G” in `clock.getElapsedTime()` should not be capitalized.

So, change this:

```javascript
  var time = clock.GetElapsedTime();

```

To this:

```javascript
  var time = clock.getElapsedTime();

```

After that, your code should be working perfectly.

-Chris
