TypeError: document.getElementsByTagName("p").filter is not a function
Because you don't get an array, only something array-like.