How do I make a <button> show a specific text in console.log when I click on the button?

Viewed 1445

I've been coding for a week and I'm stuck on my online assigment where they want me to create a button that displays a text in console.log when I click on it. Been at it for 3 hours now checking different forums, youtube videos and topics but can't find a specific "simple" answer. Can anyone help me out?

1 Answers

function log() {
  console.log('Clicked');
};
<button onclick="log()">Click me!</button>

Related