Could you guys ask me if the code is corrupt?

//Create function to select elements

const selectElement = (element) => document.querySelector(element);

//Open and close nav on click

selectElement(element: '.menu-icons') , addEventListener(type:'click', listener:()=>{

    selectElement(element:'nav') . classList.toggle(token:'active')

});

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

do you want just the question “is the code corrupt?”?

yes!
can you help me

I assume this is a translation error, the code is not “corrupt”. It’s just not correct syntax, I would read up on how you write functions (and function parameters) in JavaScript. Can you explain how you think this would work, just so I can understand what you get and don’t get re JS syntax?

That type: and listener: bit looks like the parameter hints from IDEA/WebStorm, and I’m guessing you typed them based on a screenshot or something? Those are just visual cues, you don’t actually type them.

1 Like