How is this function executed?

recently read ide" rel=" nofollow noreferrer "> functional programming Guide

I can"t understand the part of the container. There is a code that says Functor as follows:

class Maybe {
  static of(x) {
    console.log(1);
    return new Maybe(x);
  }

  get isNothing() {
    console.log(2);
    return this.$value === null || this.$value === undefined;
  }

  constructor(x) {
    console.log(3);
    this.$value = x;
  }

  map(fn) {
    console.log(4);
    return this.isNothing ? this : Maybe.of(fn(this.$value));
  }

  inspect() {
    console.log(5);
    return this.isNothing ? "Nothing" : `Just(${this.$value})`;
  }
}

var test1 = Maybe.of("Malkovich Malkovich");
console.log(test1);

var test2 = Maybe.of(null).map(_.match(/a/ig));
console.log(test2);

var test3 = Maybe.of({ name: "Boris" })
                  .map(_.prop("age"))
                  .map(_.add(10));
console.log(test3);

var test4 = Maybe.of({ name: "Boris", age: 14 })
                  .map(_.prop("age"))
                  .map(_.add(10));
console.log(test4);

what is strange and incomprehensible is how the inspect function is executed? There seems to be no place to call this function.
I hope there is a great god who can answer and communicate with me.


inspect is only used to check the values in the container. You do not call it here, and of course you will not execute

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34da5-2b2ae.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34da5-2b2ae.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?