Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Hex{
- constructor(value){
- this.value = value;
- }
- toString(){
- return "0x" + this.value.toString(16).toUpperCase();
- }
- valueOf(){
- return this.value;
- }
- plus(hex){
- return new Hex(this.value + hex);
- }
- minus(hex){
- return new Hex(this.value - hex);
- }
- static parse(hex){
- return parseInt(hex,16);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment