Travis build: 884
This commit is contained in:
@ -1,8 +1,11 @@
|
||||

|
||||
|
||||
# 30 seconds of code
|
||||
# 30 seconds of code [](https://www.producthunt.com/posts/30-seconds-of-code)
|
||||
[](https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE) [](https://gitter.im/30-seconds-of-code/Lobby) [](http://makeapullrequest.com) [](https://travis-ci.org/Chalarangelo/30-seconds-of-code) [](https://insight.io/github.com/Chalarangelo/30-seconds-of-code/tree/master/?source=0) [](https://github.com/Flet/semistandard)
|
||||
|
||||
### _Vote for this project on [Producthunt](https://www.producthunt.com/posts/30-seconds-of-code)_
|
||||
|
||||
|
||||
> Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.
|
||||
|
||||
|
||||
@ -3253,7 +3256,7 @@ round(1.005, 2); // 1.01
|
||||
### solveRPN
|
||||
|
||||
Solves the given mathematical expression in [reverse polish notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation).
|
||||
Throws appropriate errors if there are unrecognized symbols or the expression is wrong.
|
||||
Throws appropriate errors if there are unrecognized symbols or the expression is wrong. The valid operators are :- `+`,`-`,`*`,`/`,`^`,`**` (`^`&`**` are the exponential symbols and are same). This snippet does not supports any unary operators.
|
||||
|
||||
Use a dictionary, `OPERATORS` to specify each operator's matching mathematical operation.
|
||||
Use `String.replace()` with a regular expression to replace `^` with `**`, `String.split()` to tokenize the string and `Array.filter()` to remove empty tokens.
|
||||
|
||||
Reference in New Issue
Block a user