Discord
Login
Community
DARK THEME

Create object in JavaScript

I have microscript code

  player = object
    x=0
    y=0
    angle=0
  end

how to rewrite it to JavaScript?

const player = {
  x: 0,
  y: 0,
  angle: 0,
};

Courtesy of ChatGPT 😄

WARNING! That's incorrect! const will define a constant, that is, something that cannot be changed! Use var or let instead! (the rest of the syntax looks fine though)

Thanks for correcting this. I will give ChatGPT an ear full 😉

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community