The selected answer from @sdepold stated in 2012:
Sadly there is no forEach method on NodeList
The forEach method has since become part of the NodeList-Prototype and is widely supported (10 out of Top10 browsers /mobile/desktop)
https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach#browser_compatibility
I thought this question could benefit from a little update.
var nodes = document.getElementsByClassName('warningmessage')
Or more modern (and better):
const nodes = document.querySelectorAll(".warningmessage")
nodes.forEach( element => {
element.remove()
})