A.Burdonskaya
A.Burdonskaya

Reputation: 561

Export function return object Object

I'm trying to import a function from an App.js (it checks the string in the URL) to another module, but outside App.js the function returns an [object Object]. Tell me, please, what could be the reason? I tried different syntax for export, the result is the same.

export function itTest(){
    const mobileAp = location.search.indexOf("mobile=true") > -1;
    return ( mobileAp
    )}

const test = {itTest};
console.log(test)
[object Ojbect]

Upvotes: 0

Views: 490

Answers (1)

Karim
Karim

Reputation: 8632

you're creating an object with a field itTest that wraps the function

const test = {itTest};

if you want to have an alias change it to

const test = itTest;

or just use itTest directly

Upvotes: 1

Related Questions