Code for 'hide all'?

Sure, and you don’t have to create a different function for each one.
Remove your code and have something like:

const numberOfPins = 10; //Change it to the number Pins .
$w.onReady(() => {
	for(let i = 1; i <= numberOfPins; i++){
		$w('#PinBox' + i).onMouseIn(event => {
			for(let j = 1; j <= numberOfPins; j++){
				i === j ? $w('#Box' + j).show() : $w('#Box' + j).hide();
			}
		})
	}
})

This will only work if you keep the element property IDs as you wrote.