Ujala
Ujala

Reputation: 19

How to solve ReferenceError: myfunction123 is not defined at HTMLButtonElement.onclick?

i am trying to fetch the items in the array using map and call back funtion.

here is the html code

`enter code here`
  <p id="myid6"></p>
<button type="button" onclick="myfunction123()">myfunction123</button><br></br>

This is my javascript code

let abj = [1, 2, 3, 4, 5]
let abbn = abj.map(myfuntion123)


function myfuntion123(item) {
  console.log(item * 4)
}

ERROR

Blockquote ReferenceError: myfunction123 is not defined at HTMLButtonElement.onclick

HOW TO FIX THIS ERROR?????

Upvotes: -1

Views: 29

Answers (1)

Karolis Vaitkevicius
Karolis Vaitkevicius

Reputation: 340

I think it could be due to your javascript function name being called "myfuntion123" while in your html you are calling "myfunction123"

The names do not match. It's missing a "c".

Upvotes: 0

Related Questions