“Vevo” Kode Jawaban

Vevo

if (typeof window !== 'undefined') {
    console.log('we are running on the client')
} else {
    console.log('we are running on the server');
}
Strange Starling

Vevo

const getLanguage = () => navigator.userLanguage || (navigator.languages && navigator.languages.length && navigator.languages[0]) || navigator.language || navigator.browserLanguage || navigator.systemLanguage || 'en';

console.log(getLanguage());
Strange Starling

Vevo

if (typeof window !== 'undefined') {
    localStorage.setItem('myCat', 'Tom');
}
Strange Starling

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya