From 1e6f93ae9c94a3b894cb503f563c4b537c43c4b9 Mon Sep 17 00:00:00 2001 From: Rohit Tanwar <31792358+kriadmin@users.noreply.github.com> Date: Tue, 2 Jan 2018 21:37:31 +0530 Subject: [PATCH] Update --- snippets/postfixToInfix.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/snippets/postfixToInfix.md b/snippets/postfixToInfix.md index 52d1a89bb..6736859e6 100644 --- a/snippets/postfixToInfix.md +++ b/snippets/postfixToInfix.md @@ -4,9 +4,7 @@ ``` js const postfixToInfix = RPN => { let convert = RPN.replace(/\^/g,'**').split(/\s+/g).filter(el => !/\s+/.test(el) && el !== '') - let stack = [] - let result = [] - let precedence = {null : 4 ,'**':3 ,'/' : 2,'*': 2,'+':1,'-':1 } + let [stack,result,precedence] = [[],[],{null : 4 ,'**':3 ,'/' : 2,'*': 2,'+':1,'-':1 }] convert.forEach(symbol => { let stra,strb if(!isNaN(parseFloat(symbol)) && isFinite(symbol)){