As Shan says, check your elements id name as it states in the example itself.
https://support.wix.com/en/article/corvid-tutorial-displaying-elements-in-mobile-only
… In line 2 above, there is a reference to “#button8” , and the code sets that element to be hidden. The element you want to display is probably not named button8, so you’ll need to modify this code to make it work on your page.
To make this code work with your element, replace button8 with the ID for your element that you noted in step 3…

I have used it myself and it all works fine.
import wixWindow from 'wix-window';
$w.onReady(function () {
if(wixWindow.formFactor === "Mobile"){
$w("#mobilelogo").show();
$w("#mobilelogo1").show();
$w("#menuheaderstrip").show();
}
});