ex06-07-1-2

実行結果

Object    {[object Window]   window: undefined, [object Window]   self: undefined, [object HTMLDocument]   document: undefined, ""   name: undefined, https://marlin-arms.com/support/ljs3/example-mbl/ch06/ex06-07-1-2/index.html   location: undefined, [object CustomElementRegistry]   customElements: undefined, [object History]   history: undefined, [object Navigation]   navigation: undefined, [object BarProp]   locationbar: undefined, [object BarProp]   menubar: undefined, [object BarProp]   personalbar: undefined, [object BarProp]   scrollbars: undefined, [object BarProp]   statusbar: undefined, [object BarProp]   toolbar: undefined, ""   status: undefined, false   closed: undefined, [object Window]   frames: undefined, 0   length: undefined, [object Window]   top: undefined, null   opener: undefined, [object Window]   parent: undefined, null   frameElement: undefined, [object Navigator]   navigator: undefined, "https://marlin-arms.com"   origin: undefined, [object External]   external: undefined, [object Screen]   screen: undefined, 1280   innerWidth: undefined, 720   innerHeight: undefined, 0   scrollX: undefined, 0   pageXOffset: undefined, 0   scrollY: undefined, 0   pageYOffset: undefined, [object VisualViewport]   visualViewport: undefined, 0   screenX: undefined, 0   screenY: undefined, 1280   outerWidth: undefined, 720   outerHeight: undefined, 1   devicePixelRatio: undefined, undefined   event: undefined, [object Navigator]   clientInformation: undefined, 0   screenLeft: undefined, 0   screenTop: undefined, [object StyleMedia]   styleMedia: undefined, null   onsearch: undefined, true   isSecureContext: undefined, [object TrustedTypePolicyFactory]   trustedTypes: undefined, [object Performance]   performance: undefined, null   onappinstalled: undefined, null   onbeforeinstallprompt: undefined, [object Crypto]   crypto: undefined, [object IDBFactory]   indexedDB: undefined, [object Storage]   sessionStorage: undefined, [object Storage]   localStorage: undefined, null   onbeforexrselect: undefined, null   onabort: undefined, null   onbeforeinput: undefined, null   onbeforematch: undefined, null   onbeforetoggle: undefined, null   onblur: undefined, null   oncancel: undefined, null   oncanplay: undefined, null   oncanplaythrough: undefined, null   onchange: undefined, null   onclick: undefined, null   onclose: undefined, null   oncontentvisibilityautostatechange: undefined, null   oncontextlost: undefined, null   oncontextmenu: undefined, null   oncontextrestored: undefined, null   oncuechange: undefined, null   ondblclick: undefined, null   ondrag: undefined, null   ondragend: undefined, null   ondragenter: undefined, null   ondragleave: undefined, null   ondragover: undefined, null   ondragstart: undefined, null   ondrop: undefined, null   ondurationchange: undefined, null   onemptied: undefined, null   onended: undefined, null   onerror: undefined, null   onfocus: undefined, null   onformdata: undefined, null   oninput: undefined, null   oninvalid: undefined, null   onkeydown: undefined, null   onkeypress: undefined, null   onkeyup: undefined, null   onload: undefined, null   onloadeddata: undefined, null   onloadedmetadata: undefined, null   onloadstart: undefined, null   onmousedown: undefined, null   onmouseenter: undefined, null   onmouseleave: undefined, null   onmousemove: undefined, null   onmouseout: undefined, null   onmouseover: undefined, null   onmouseup: undefined, null   onmousewheel: undefined, null   onpause: undefined, null   onplay: undefined, null   onplaying: undefined, null   onprogress: undefined, null   onratechange: undefined, null   onreset: undefined, null   onresize: undefined, null   onscroll: undefined, null   onsecuritypolicyviolation: undefined, null   onseeked: undefined, null   onseeking: undefined, null   onselect: undefined, null   onslotchange: undefined, null   onstalled: undefined, null   onsubmit: undefined, null   onsuspend: undefined, null   ontimeupdate: undefined, null   ontoggle: undefined, null   onvolumechange: undefined, null   onwaiting: undefined, null   onwebkitanimationend: undefined, null   onwebkitanimationiteration: undefined, null   onwebkitanimationstart: undefined, null   onwebkittransitionend: undefined, null   onwheel: undefined, null   onauxclick: undefined, null   ongotpointercapture: undefined, null   onlostpointercapture: undefined, null   onpointerdown: undefined, null   onpointermove: undefined, null   onpointerrawupdate: undefined, null   onpointerup: undefined, null   onpointercancel: undefined, null   onpointerover: undefined, null   onpointerout: undefined, null   onpointerenter: undefined, null   onpointerleave: undefined, null   onselectstart: undefined, null   onselectionchange: undefined, null   onanimationend: undefined, null   onanimationiteration: undefined, null   onanimationstart: undefined, null   ontransitionrun: undefined, null   ontransitionstart: undefined, null   ontransitionend: undefined, null   ontransitioncancel: undefined, null   onafterprint: undefined, null   onbeforeprint: undefined, null   onbeforeunload: undefined, null   onhashchange: undefined, null   onlanguagechange: undefined, null   onmessage: undefined, null   onmessageerror: undefined, null   onoffline: undefined, null   ononline: undefined, null   onpagehide: undefined, null   onpageshow: undefined, null   onpopstate: undefined, null   onrejectionhandled: undefined, null   onstorage: undefined, null   onunhandledrejection: undefined, null   onunload: undefined, false   crossOriginIsolated: undefined, [object Scheduler]   scheduler: undefined, function   alert: undefined, function   atob: undefined, function   blur: undefined, function   btoa: undefined, function   cancelAnimationFrame: undefined, function   cancelIdleCallback: undefined, function   captureEvents: undefined, function   clearInterval: undefined, function   clearTimeout: undefined, function   close: undefined, function   confirm: undefined, function   createImageBitmap: undefined, function   fetch: undefined, function   find: undefined, function   focus: undefined, function   getComputedStyle: undefined, function   getSelection: undefined, function   matchMedia: undefined, function   moveBy: undefined, function   moveTo: undefined, function   open: undefined, function   postMessage: undefined, function   print: undefined, function   prompt: undefined, function   queueMicrotask: undefined, function   releaseEvents: undefined, function   reportError: undefined, function   requestAnimationFrame: undefined, function   requestIdleCallback: undefined, function   resizeBy: undefined, function   resizeTo: undefined, function   scroll: undefined, function   scrollBy: undefined, function   scrollTo: undefined, function   setInterval: undefined, function   setTimeout: undefined, function   stop: undefined, function   structuredClone: undefined, function   webkitCancelAnimationFrame: undefined, function   webkitRequestAnimationFrame: undefined, function   __playwright__binding__: undefined, [object CacheStorage]   caches: undefined, [object CookieStore]   cookieStore: undefined, null   ondevicemotion: undefined, null   ondeviceorientation: undefined, null   ondeviceorientationabsolute: undefined, [object LaunchQueue]   launchQueue: undefined, [object SharedStorage]   sharedStorage: undefined, [object DocumentPictureInPicture]   documentPictureInPicture: undefined, function   getScreenDetails: undefined, function   openDatabase: undefined, function   queryLocalFonts: undefined, function   showDirectoryPicker: undefined, function   showOpenFilePicker: undefined, function   showSaveFilePicker: undefined, true   originAgentCluster: undefined, null   onpageswap: undefined, null   onpagereveal: undefined, false   credentialless: undefined, null   fence: undefined, [object SpeechSynthesis]   speechSynthesis: undefined, null   onscrollend: undefined, null   onscrollsnapchange: undefined, null   onscrollsnapchanging: undefined, function   webkitRequestFileSystem: undefined, function   webkitResolveLocalFileSystemURL: undefined, [object Object]   __pwInitScripts: undefined, function   outarg: undefined, function   out: undefined, 0   TEMPORARY: undefined, 1   PERSISTENT: undefined, function   addEventListener: undefined, function   dispatchEvent: undefined, function   removeEventListener: undefined,    }
si eman ym ,olleH

ソース

const o = {
  name: 'Julie',
  greetBackwards: function() {

    const getReverseName = function() {
      console.log(this); // { name: 'Julie', greetBackwards: [Function] } ◆→出力と違うけどOK?←◆
      let nameBackwards = '';
      for(let i=this.name.length-1; i>=0; i--) {
        nameBackwards += this.name[i];
      }
      return nameBackwards;
    };

    return `${getReverseName()} si eman ym ,olleH`;
  }, // greetBackwards のプロパティの関数の終わり
};

console.log(o.greetBackwards()); // eiluJ si eman ym ,olleH