## h2 ``` const SequenceUtils = { genUUID() { let date = Date.now(); if ( typeof performance !== "undefined" && typeof performance.now === "function" ) { date += performance.now(); //use high-precision timer if available } return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( /[xy]/g, function (c) { const r = (date + Math.random() * 16) % 16; date = Math.floor(date / 16); return (c === "x" ? r : (r & 0x3) | 0x8).toString(16); } ); }, }; ``` 問題說明 主要不懂`(r & 0x3) | 0x8).toString(16)`,為甚麼`| 0x8`會保證產出的字元會是8(1000),9(1001),A(1010),B(1011) 參考[這篇](http://www.itwanger.com/java/2020/08/02/java-uuid.html)覺得解釋的算很清楚了,但 https://www.uuidtools.com/decode