Javascript stopwatch error

let sw = new Stopwatch()
I am having a problem with the object creation. I declare a stopwatch but it says:
“Uncaught ReferenceError: Stopwatch is not defined”

That’s what happens for me too. As far as I know, there is no built-in Stopwatch class.

This is chapter 14? It’s an excercise, you have to create Stopwatch yourself. See chapter 15 for the solution.

Has anyone successfully implemented the stopwatch exercise (exercise 14)?
I copied exactly what the instructor (on lesson 15) has but not getting it to work properly.

const sw = new Stopwatch();
Then
sw.start ----> get the function source code on console rather than output.

sw.stop ---->get the function source code on console rather than output.

sw.duration ----> OK. Always get 0

Anything I am doing wrong to get the source code rather than the output?

Thanks for chiming in.
DMC

Has anyone successfully implemented the stopwatch exercise (exercise 14)?
I copied exactly what the instructor (on lesson 15) has but not getting it to work properly.

const sw = new Stopwatch();
Then
sw.start ----> get the function source code on console rather than output.

sw.stop ---->get the function source code on console rather than output.

sw.duration ----> OK. Always get 0

Anything I am doing wrong to get the source code rather than the output?

Thanks for chiming in.
DMC

I think you need to call the functions, for example

sw.start()
sw.stop()

Notice the parentheses.

Thank you eelsholz!

That was it. I also did not use "const sw = stopwatch(); "
to start with. Thanks for catching it for me. Practice makes perfect!
DMC