Please tell us how the function exported by js export refers to undefined as return.

related codes

// index1.js
export function getInitTime() {
  const nowTime = new Date();
  const nowTimeStamp = new Date().getTime();
  return {
    nowTime,
    nowTimeStamp 
  }
}

// index2.js
import { getInitTime } from "./index1";
console.log(getInitTime);    // 
console.log(getInitTime.nowTime);    //undefined

what result do you expect? What is the error message actually seen?

I hope I can get the value of import . Thank you

.
Mar.11,2022

getInitTime (). NowTime

Menu