Function call problem

when I call the function it says “word”(num,str,any) is not defined no matter if I put “word”(num,str,any) in parenthesess in a function call and after the function name,
thank you

please expand, there is not enough info to understand what’s going on

function name (any){
return …
any is not defined

Look at the error, it says any is not defined.
You have to define any

Looking at your code

It is not clear what you are returning. So, I will assume you are returning any.

function name(any){

name(any)// this will return an error

//what function name does is that it return the input 
//given to it

Try initialising a variable any. Than the function should be able to work.

any seems to be a variable, and if it is not defined anywhere, then it is undefined as it say. You can’t use variables before defining them

first I need to make let any = “dog” ?

what value do you want to call the function with?

can I write all the code so you can help me with that and another problem

let str = "Dog"

    function comb (str){

        let z = str.shift();




node on terminal on VS Code says str.shift is not a function… and value to call the function is str… what I did wrong , you cant shift inside a function or what?

what do you want to accompish with your code, what issue are you having?

Write a JavaScript function that generates all combinations of a string. Go to the editor
Example string : ‘dog’
Expected Output : d,do,dog,o,og,g

so you want to call your function with a string, like for example "dog", so you need to do comb("dog"), when you call the function you need to put a value in it

like this:

let str = "Dog"
    function comb (str){
        let z = str.shift();

I would suggest you go through some basic javascript lessons, as I see some issues with most basic concepts

For example, try the JavaScript certification in the freeCodeCamp curriculum:

i passed trough and will again, thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.