Simple Calculator - Cordova Typing CST Test
Loading…
Simple Calculator — Cordova Code
A basic calculator performing addition, subtraction, multiplication, and division.
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
<script>
let display = '';
function press(num) { display += num; document.getElementById('result').value = display; }
function calculate() { try { display = eval(display); document.getElementById('result').value = display; } catch(e){ alert('Error'); } }
function clearDisplay() { display=''; document.getElementById('result').value=''; }
</script>
</head>
<body>
<h1>Calculator</h1>
<input id='result' readonly/><br/>
<button onclick='press("1")'>1</button>
<button onclick='press("2")'>2</button>
<button onclick='press("+")'>+</button>
<button onclick='calculate()'>=</button>
<button onclick='clearDisplay()'>C</button>
</body>
</html>Cordova Language Guide
Apache Cordova is an open-source mobile development framework that enables developers to build cross-platform mobile applications using HTML, CSS, and JavaScript. It wraps web applications into native containers to run on multiple mobile platforms.
Primary Use Cases
- ▸Hybrid mobile apps for iOS, Android, and Windows
- ▸Enterprise apps needing rapid deployment across platforms
- ▸Prototyping mobile apps quickly using web technologies
- ▸Apps requiring native device functionality via plugins
- ▸Web-to-mobile porting of existing web applications
Notable Features
- ▸Cross-platform mobile app development
- ▸Access to device hardware through plugins
- ▸Single codebase for multiple platforms
- ▸Integration with popular front-end frameworks (Vue, React, Angular)
- ▸Open-source with a large plugin ecosystem
Origin & Creator
Originally created by Nitobi in 2009 as PhoneGap, it was later donated to the Apache Software Foundation and renamed Cordova. The project standardized the approach for hybrid mobile app development.
Industrial Note
Perfect for rapid development of cross-platform mobile apps where leveraging existing web development skills is critical.