The value passed to the element selector function (usually $w), must be of type string

Do something like:

const menuItems = ['Home', 'About', 'Shop',/*etc..*/];
$w.onReady(() => {
menuItems.forEach(e => {
$w('#' +e).onMouseIn(event => {
	$w(`#${e}Line`).show();
	$w(`#${e}Box`).expand();
})
$w('#' +e).onMouseOut(event => {
	$w(`#${e}Line`).hide();
	$w(`#${e}Box`).collapse();
})
})
})