Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Degrees

Represents an angle

example

Create with number

const degrees = new Degrees(180);
degrees.toString();  // -> '180°'
`${degrees}`;  // -> '180'
+degrees;  // -> 180
degrees.value;  // -> 180
example

Create with a degree instance

const previous = new Degrees(180);
const degrees = new Degrees(previous);
degrees.toString();  // -> '180°'
example

Convert to radians

const degrees = new Degrees(180);
const radians = radians.toRadians();
radians.toString();  // -> '2π rad'

Hierarchy

Implements

Index

Constructors

constructor

Properties

max

max: number

min

min: number

Accessors

value

  • get value(): number
  • set value(value: number): void

Methods

__@toPrimitive

  • __@toPrimitive(hint: "string" | "number" | "default"): string | number

__@toStringTag

  • __@toStringTag(): string

get

  • get(): number

set

toJSON

  • toJSON(_?: string): any | number | string | boolean | null
  • Converts the primitive into it's JSON representation

    Parameters

    • Default value _: string = ""

    Returns any | number | string | boolean | null

    the object to serialize with JSON.stringify

toRadians

  • toRadians(): number
  • Converts the degrees into radians

    Returns number

    the converted radians value

toString

  • toString(): string

valueOf

  • valueOf(): number