The Weekly Web Dev Challenge: String Calculator
The Weekly Web Dev Challenge: String Calculator

%23WeeklyWebDevChallenge
const mainContainer = document.getElementById("main-container")
const equationField = document.getElementById("equation-field")
const solveButton = document.getElementById("solve-button")
const solutionDisplay = document.getElementById("solution-display")
solveButton.addEventListener("click", function() {
// Clears the solution contents on each click
solutionDisplay.innerHTML = ``
// Write your code here
})
/*
Part 1 (Calculation):
+Your first goal is to solve a simple text-based
math problem entered in the input field
+The problem can be add/sub/multiply/divide
+Here are few examples:
"3 + 3" -> 6
"10 - 3" -> 7
"44 / 2" -> 22
"2 * 8" -> 16
+When the 'Solve' button is clicked
-Create a new div with the
class 'equation-component'
its text value should be the solution
to the input equation
-This element should be added as a child of
the `solutionDisplay` div
Note: You can assume there will always only be 2 values,
both whole integers, and always a space between each
integer and the operator as in the above examples
Part 2 (Flex Display):
Then, you'll Flex your Flexbox skills!
+ Vertically stack the contents of the mainContainer
+ Center the content horizontally
+ Display all components of the equation
in the solutionDisplay using a horizontal Flexbox
with `space around` each component
Skills:
Event Listeners, String Manipulation, Array Manipulation,
Arithmetic, DOM Manipulation, Flexbox
STRETCH GOALS:
+Accept and solve more complex problems with more than 2 inputs
+Signal the different types of components (operator/value/solution) with different colors
+Accept strings without spaces
+Can you improve the overall design?
*/
refs
https://scrimba.com/scrim/coc3c469d9114ebc2cf00a3f7
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
The Weekly Web Dev Challenge: String Calculator的更多相关文章
- The Weekly Web Dev Challenge: Emoji Ratings
The Weekly Web Dev Challenge: Emoji Ratings /* DESCRIPTION: You job is to enable users to give a rat ...
- 解决:无法在发送 HTTP 标头之后进行重定向。 跟踪信息: 在 System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent) 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>……
问题:在MVC的过滤器中验证用户状态时报如下错误: 无法在发送 HTTP 标头之后进行重定向. 跟踪信息: 在 System.Web.HttpResponse.Redirect(String ...
- java web dev知识积累
tomcat体系结构 可以从tomcat的server.xml文件中元素的层次结构来理解tomcat的体系结构: Server(可以视为tomcat本身)->经由connector可以有多个(c ...
- KMP algorithm challenge string.Contains
KMP: public int KMP (ReadOnlySpan<char> content, ReadOnlySpan<char> span) { _next = new ...
- [codechef July Challenge 2017] Calculator
CALC: 计算器题目描述大厨有一个计算器,计算器上有两个屏幕和两个按钮.初始时每个屏幕上显示的都是 0.每按一次第一个按钮,就会让第一个屏幕上显示的数字加 1,同时消耗 1 单位的能量.每按一次第二 ...
- 73th LeetCode Weekly Contest Custom Sort String
S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sort ...
- Weekly Contest 111-------->942. DI String Match
Given a string S that only contains "I" (increase) or "D" (decrease), let N = S. ...
- Java Web dev搭建经验总结
摘要: 原创出处:www.bysocket.com 泥瓦匠BYSocket 希望转载,保留摘要,谢谢! 回馈分析法使我看到,我对专业技术人员,不管是工程师.会计师还是市场研究人员,都容易从直觉上去理解 ...
- AWD - IDE For Web dev汉化版
一款安卓上的HTML网页编辑软件,不错哦 下载链接 http://t.cn/AiRIvtoL
随机推荐
- java 本地方法(JNI)
最近搞了一个调用第三方so库做登录认证的任务,以前对JNI没什么概念,最近学习了 <java核心技术> 本地方法 一章,把自己写的一些例子记录一下. 自己C语言真是渣渣,所以所有的例子都在 ...
- three.js cannon.js物理引擎之制作拥有物理特性的汽车
今天郭先生说一说使用cannon.js的车辆辅助类让我们的汽车模型拥有物理特性.效果图如下,在线案例请点击博客原文. 下面我们说一下今天要使用的两个类,并简单的看看他们的物理意义 1. Raycast ...
- python 基础学习4 字典和循环语句
学了这么多天的基础,好着急的想什么时候可以开始写个小程序,今天还是静下心来把字典和循环语句学习了 关于字典,主要是了解了字典的创建,和映射,以及一些基本的运算法,运算法不一一列出,运算法在用到的时候会 ...
- Uniter 单一框架学习
unittest单元测试框架不仅可以适用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行测试用例,并且提供了丰富的断言方法,判断测试用例是否通过,最终生成测试结果. 一.u ...
- JavaWeb-tomcat安装(Unsupported major.minor version 51.0/startup.bat闪退)
JavaWeb-tomcat安装(Unsupported major.minor version 51.0) 一 启动startup.bat 出错i 今天安装tomcat出错,折腾了一下午,收获了许多 ...
- POJ1113:Wall (凸包算法学习)
题意: 给你一个由n个点构成的多边形城堡(看成二维),按顺序给你n个点,相邻两个点相连. 让你围着这个多边形城堡建一个围墙,城堡任意一点到围墙的距离要求大于等于L,让你求这个围墙的最小周长(看成二维平 ...
- 2019HDU多校 Round9
Solved:3 02 Rikka with Cake (树状数组) #include <bits/stdc++.h> using namespace std; typedef long ...
- 【uva 1614】Hell on the Markets(算法效率--贪心)
题意:有一个长度为N的序列A,满足1≤Ai≤i,每个数的正负号不知.请输出一种正负号的情况,使得所有数的和为0.(N≤100000) 解法:(我本来只想静静地继续做一个口胡选手...←_← 但是因为这 ...
- Educational Codeforces Round 102 (Rated for Div. 2) B. String LCM (构造,思维)
题意:给你两个字符串\(a\)和\(b\),找出它们的\(lcm\),即构造一个新的字符串\(c\),使得\(c\)可以由\(x\)个\(a\)得到,并且可以由\(y\)个\(b\)得到,输出\(c\ ...
- poj3260 The Fewest Coins
Description Farmer John has gone to town to buy some farm supplies. Being a very efficient man, he a ...