You asked
What are the alternatives to the nikon af s dx micro 40mm f 2 8g?
The site's catalogue doesn't list other macro lenses for this one, so the guide can't offer a like-for-like macro alternative. The closest page is the Nikon AF-S DX 35mm f/1.8G, another prime for APS-C cameras. It is a fast lens for everyday and low-light shooting, but it is not a macro lens, so it won't give you the same close-up magnification. The page gives no price, so the guide can't compare cost.
The 40mm micro is itself a budget pick. On an APS-C body it frames about like a 60mm lens on full frame, and f/2.8 gives roughly the depth of field of f/4.2 there. For close-ups, that is a reasonable working distance. The guide's focal length page explains how aperture and depth of field change with sensor size, which helps when you compare it with other lenses.
If your real interest is people rather than close-up work, the portraits guide is more useful. It recommends the 50mm f/1.8 as the cheapest great lens for almost any mount, and the 85mm f/1.8 as the classic full-frame portrait lens. Neither is a macro lens, but both are fast and well suited to portraits.
The 40mm micro fits many Nikon F bodies, from the D3300 to the D850. Check the price on its catalogue page before you buy, because prices change.
Written by Claude from this site's pages.
From these pages
This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.