Light Mode
Dark Mode
Error in the given function header

So, I kept getting the following error:

13,19: Argument of type 'string' is not assignable to parameter of type 'number'.

After spending some time, I found out that the problem was the part of the function that is given to the user when starting the exercise:

function threeWords(text: string): boolean {

The "string" is what causes the error. Replacing the function header by the following fixes the problem and allowed me to complete the exercise:

function threeWords(text): boolean {

Also, this is not the first time I encounter this problem, but unfortunately I did not keep track of where else it occurred.

Created: Dec. 24, 2020, 9:52 a.m.
Updated: Dec. 24, 2020, 6:42 p.m.
0
16
User avatar
ddavidse