How can I improve this basic site code?

How can I improve this basic site code?

ยท

1 min read

I created a basic JS, HTML, CSS site yesterday that rotates an emoji 90 degrees every time the user clicks it.

To create the spinning emoji, I created four divs with the original, upright emoji (๐Ÿ”ƒ).

I gave them each class names that would allow for the CSS to identify each of them separately. In styles.css, I gave each of the corresponding class names an element that rotates the block that it is in by 90, 180 or 270 degrees.

I also added JS so that whenever the current ๐Ÿ”ƒ was clicked, it would disappear, and be replaced by the next, rotated ๐Ÿ”ƒ.

The reason why I posted this is because it seems very inefficient. Is there any other way of making this ๐Ÿ”ƒ emoji spin every time it's clicked, without having to make itself disappear and have the next one appear?

I hope this makes some sort of sense.

Here is the GitHub repository of the project: github.com/GetOutOfThatGarden/Spinner-me-ti..

And apologies for the incorrect use of any terms above. Please let me know where I went wrong in explaining this post.

Also thanks to Brian Design on youtube for this tutorial: youtube.com/watch?v=mCQ1-iDSnto

Thanks, Niall

ย