1. Operadores aritméticos

    1. Subtração:
      1. ( - )
    2. Soma:
      1. ( + )
    3. Divisão:
      1. ( \ )
    4. Multiplicação:
      1. ( * )
    5. Módulo — resto da divisão:
      1. ( % )
    6. Exponenciação:
      1. ( ** )
    7. Incremento:
      1. ( ++ )
    8. Decremento:
      1. ( -- )
  2. ,

  3. ;

  4. :

  5. !==

  6. ()

  7. [].indexOf()

  8. {}

  9. &&

  10. `

  11. <=

  12. =

  13. ${}

  14. case

  15. class

  16. console.log

  17. else

  18. Error

  19. export

  20. function

  21. if

  22. is

  23. new

  24. number

  25. private

  26. protected

  27. public

  28. return

  29. string

  30. switch

  31. this

  32. throw

  33. undefined

Exemplos

  1. Calculadora:
    1. Código typescript

      
       export class Calculator {
       private current = 0;
       private memory = 0;
       private operator: string;
       protected processDigit(digit: string, currentValue: number) {
           if (digit >= "0" && digit <= "9") {
           return currentValue * 10 + (digit.charCodeAt(0) - "0".charCodeAt(0));
           }
       }
       protected processOperator(operator: string) {
           if (["+", "-", "*", "/"].indexOf(operator) >= 0) {
           return operator;
           }
       }
       protected evaluateOperator(
           operator: string,
           left: number,
           right: number
       ): number {
           switch (this.operator) {
           case "+":
               return left + right;
           case "-":
               return left - right;
           case "*":
               return left * right;
           case "/":
               return left / right;
           }
       }
       private evaluate() {
           if (this.operator) {
           this.memory = this.evaluateOperator(
               this.operator,
               this.memory,
               this.current
           );
           } else {
           this.memory = this.current;
           }
           this.current = 0;
       }
       public handleChar(char: string) {
           if (char === "=") {
           this.evaluate();
           return;
           } else {
           let value = this.processDigit(char, this.current);
           if (value !== undefined) {
               this.current = value;
               return;
           } else {
               let value = this.processOperator(char);
               if (value !== undefined) {
               this.evaluate();
               this.operator = value;
               return;
               }
           }
           }
           throw new Error(`Unsupported input: '${char}'`);
       }
       public getResult() {
           return this.memory;
       }
       }
       export function test(c: Calculator, input: string) {
       for (let i = 0; i < input.length; i++) {
           c.handleChar(input[i]);
       }
       console.log(`result of '${input}' is '${c.getResult()}'`);
       }
      
      
      
    2. .

    3. .

🔝🔝