Does the 50mm f/1.8G and D work on Nikon D3100?

I'm a beginner, so yeah. Also is 50mm good for street photography(B&W) and portraits.

You need to look to see if the lens is an AF-S lens or not. Only AF-S lenses work on your entry level D3100
Here is a link to all the available Nikkor lenses.

The 50mm f/1.8D won't autofocus on your D3100, but the 50mm f/1.8G will.
As for quality, be inspired by some of these amazing images taken with a 50mm lens and a Nikon D3100 exactly like yours.

You need the 50mm f/1.8 G. The D will not autofocus, but the G will. Both will 'work' in the sense that it will capture shots, but only the G will autofocus.
I have a 50mm 1.8 G and I'm in love with it. Sharp. Sharp. Sharp!
Have fun!
- Does the Nikon 50mm f1.8G AF-S Nikkor lens work well with a Nikon D3000?
- Does the Nikon D3100 DSLR have manual focus and will it work with a F-601 lens?
- Nikkor 50mm AF-S 50mm f/1.4G or AF 50mm f/1.8G?
- Does the 50mm work with my Nikon D60?
- Is there a difference in quality between Nikon 50mm 1.8 AF and Nikon 50mm 1.8 AI-S?