Write a JavaScript function to get all prime numbers from 0 to a specified number.