Coming to the frontend from Java, what caught me off guard
I started out in Java and moved into frontend work. A lot of it transferred fine. A few things genuinely surprised me. Here are the ones worth knowing about.

I started out writing Java. Strong types, a compiler that argues with you before anything runs, a clear place for everything. When I moved into frontend work, a lot of it carried over more smoothly than people warned me it would. But a few things genuinely threw me, and I wish someone had just told me about them up front. So here they are.
The compiler stops holding your hand
In Java, if I got a type wrong, I knew before I ran anything. The compiler would not let me get away with it. Plain JavaScript does not do that. It happily runs code that makes no sense and only falls over later, often somewhere far away from the actual mistake.
The thing that made me comfortable again was TypeScript. It brings back that "tell me now, not later" feeling I missed from Java. If you are coming from a typed language, do not spend long in plain JavaScript feeling like the floor is missing. Reach for TypeScript early. It thinks the way you already think.
Nothing waits for you
This was the big one. In a lot of Java code, you ask for something and the line just waits until you get an answer before moving on. In the browser, if you waited like that, the whole page would freeze. So almost everything that takes time, fetching data, reading a file, talking to a server, happens without blocking, and you say what to do when the answer comes back later.
It took me a bit to stop fighting this and start thinking in terms of "this will finish eventually, here is what to do then." Once it clicked, async and await made it read almost like normal step-by-step code again. But it is a real shift, and it is worth slowing down to actually understand it rather than copying patterns and hoping.
The screen is a reflection of your data
The habit that made the biggest difference to my code was small: stop reaching into the page to change it by hand. In modern frontend work you keep your data in one place, and the screen is drawn from that data. You change the data, and the screen updates itself to match.
Coming from moving things around directly, this felt indirect at first. Now it feels obvious. When something on screen is wrong, I do not go hunting through the page. I look at the data behind it, because the screen is only ever showing me what the data says.
The user is right there watching
The last thing is more a change of mindset than a technical one. A backend mistake is usually quiet. A frontend mistake is right in front of the person using the app: a button that does nothing, a form that loses what they typed, a spinner that never stops.
That sounds stressful, and at first it was. But it also made the work feel more direct. You are not building something abstract that runs in a data centre somewhere. You are building the thing a real person is looking at and touching. Getting the small stuff right, so it feels calm and predictable, turned out to be the part I enjoy most.
None of my Java background went to waste, by the way. Caring about types, structure and edge cases is just as useful on the frontend. It just shows up in different places.