/**
* @param {string} s
* @return {boolean}
*/
var isValid = function(s) {
let tmpStack = [];
for(let i = 0; i < s.length; i++){
let el = s[i];
if(el=='(' || el=='{' || el =='['){
tmpStack.push(el);
} else {
if(el == ')' && tmpStack[tmpStack.length-1]=='('){
tmpStack.pop();
} else if (el == ']' && tmpStack[tmpStack.length-1] == '['){
tmpStack.pop();
} else if (el == '}' && tmpStack[tmpStack.length-1] == '{'){
tmpStack.pop();
} else {
tmpStack.push(el);
}
}
}
if(tmpStack.length){
return false;
} else {
return true;
}
};