Stack

Developer
Size
1,571 Kb
Views
10,120

How do I make an stack?

What is a stack? How do you make a stack? This script and codes were developed by Maria on 14 October 2022, Friday.

Stack Previews

Stack - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Stack</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>

Stack - Script Codes JS Codes

function x(str){ var result = true; var left = "{[(".split(""); var right = "}])".split(""); // console.log(left); var stack = []; for(x of str){ switch(x){ case left[0]: j(1); break; case left[1]: j(2); break; case left[2]: j(3); break; case right[0]: j(-1); break; case right[1]: j(-2); break; case right[2]: j(-3); break; } } function j(n) { if (n > 0) { stack.push(n); } else if (n < 0) { if (stack[stack.length - 1] + n === 0) { stack.pop(); } else { result = false; } } } if (stack.length) { return false } else { return result; }
}
var str = "(())bbc(bb{}";
console.log(x(str));
Stack - Script Codes
Stack - Script Codes
Home Page Home
Developer Maria
Username tmaria
Uploaded October 14, 2022
Rating 3
Size 1,571 Kb
Views 10,120
Do you need developer help for Stack?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Maria (tmaria) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!