There was a time when I despised JavaScript. True story. But things have changed much since. What I like about modern JS is its versatility and ease of use. It has a relatively simple syntax, making it accessible to developers with varying levels of experience.
Consider a common problem used during programming teaching courses: the Polish Notation (and Reverse Polish Notation, too). Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation or simply prefix notation, is a mathematical notation in which operators precede their operands, in contrast to the more common infix notation, in which operators are placed between operands, as well as reverse Polish notation (RPN), in which operators follow their operands. PN and RPN do not need any parentheses as long as each operator has a fixed number of operands. The description “Polish” refers to the nationality of logician Jan Łukasiewicz, who invented Polish notation in 1924.
Traditional notation | Polish Notation | Reverse Polish Notation |
---|---|---|
3 + 4 | + 3 4 | 3 4 + |
3 – (4 * 5) | – 3 * 4 5 | 3 4 5 * – |
(3 + 4) * 5 | * + 3 4 5 | 3 4 + 5 * |
(3 – 4) / (5 + 2) | / – 3 4 + 5 2 | 3 4 – 5 2 + / |