2D JavaScript game with pathfinding AI

I am creating a 2D platformer from scratch using Javascript and HTML. I have the tile maps, graphics, player movement, basic enemies that move back and forth, collision detection for blocks and enemy on player etc. However I need to add some level of complexity, and this needs some “AI”. I already have a flying enemy that follows my player at a slow speed using the player’s x y position and constantly updates to reach the player no matter where they move, however this flying enemy goes through blocks, and is too simple. I want to add a flying AI where it can not see my player until it comes into “visual” range, so floor tiles obstruct the range of the AI, and the AI will once it sees the player it will begin to follow him. The AI needs to avoid floor tiles, and as soon as it can no longer see the player it travels to the last known player position, then checks one last time if it can see the player, then return back to it’s starting position, or even go into a patrol mode where it spends a short time in the area “floating around”.

I have looked into some solutions and alot of people are suggesting an A* algorithm where I create a navmesh grid for my A* where it has the floor tile locations and once the player becomes visible a function is called and the A* uses the current players location and updates in a couple second intervals to not lag or increase the time it takes to run the game loop.

Would there be an easier way to implement this, or some easy things to add to get a better “complexity”? Any tips or tricks?

I also have many versions of the game with OOP tile maps, 1D array tileMap, 2D array tileMap, OOP created enemies, non OOP created enemies etc. What would be best to use with a A* or another type of algorithm where I need smart, efficient “AI”.

Thanks.