The Weekly Web Dev Challenge: String Calculator

https://twitter.com/intent/tweet?text=I just completed %40radicalcoder's web dev challenge on %40scrimba and built a String-based Calculator app. Check it out here%3A

%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的更多相关文章

  1. 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 ...

  2. 解决:无法在发送 HTTP 标头之后进行重定向。 跟踪信息: 在 System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent) 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>……

    问题:在MVC的过滤器中验证用户状态时报如下错误:   无法在发送 HTTP 标头之后进行重定向. 跟踪信息:   在 System.Web.HttpResponse.Redirect(String  ...

  3. java web dev知识积累

    tomcat体系结构 可以从tomcat的server.xml文件中元素的层次结构来理解tomcat的体系结构: Server(可以视为tomcat本身)->经由connector可以有多个(c ...

  4. KMP algorithm challenge string.Contains

    KMP: public int KMP (ReadOnlySpan<char> content, ReadOnlySpan<char> span) { _next = new ...

  5. [codechef July Challenge 2017] Calculator

    CALC: 计算器题目描述大厨有一个计算器,计算器上有两个屏幕和两个按钮.初始时每个屏幕上显示的都是 0.每按一次第一个按钮,就会让第一个屏幕上显示的数字加 1,同时消耗 1 单位的能量.每按一次第二 ...

  6. 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 ...

  7. Weekly Contest 111-------->942. DI String Match

    Given a string S that only contains "I" (increase) or "D" (decrease), let N = S. ...

  8. Java Web dev搭建经验总结

    摘要: 原创出处:www.bysocket.com 泥瓦匠BYSocket 希望转载,保留摘要,谢谢! 回馈分析法使我看到,我对专业技术人员,不管是工程师.会计师还是市场研究人员,都容易从直觉上去理解 ...

  9. AWD - IDE For Web dev汉化版

    一款安卓上的HTML网页编辑软件,不错哦 下载链接 http://t.cn/AiRIvtoL

随机推荐

  1. 使用amoeba实现mysql读写分离

    使用amoeba实现mysql读写分离 1.什么是amoeba? ​ Amoeba(变形虫)项目,专注 分布式数据库 proxy 开发.座落与Client.DB Server(s)之间.对客户端透明. ...

  2. (Oracle)导出表结构

    DECLARE cursor t_name is SELECT rank() over(order by a.TABLE_NAME) as xiaolonglong,a.TABLE_NAME FROM ...

  3. TCP半连接队列和全连接

    概述   如上图所示, 在TCP三次握手中,服务器维护一个半连接队列(sync queue) 和一个全连接队列(accept queue). 当服务端接收到客户端第一次SYN握手请求时,将创建的req ...

  4. 一:整合shiro

    整合shiro 1.原生的整个 1.1 创建项目 1.2 创建Realm 1.3 配置shiro 2.使用Shiro Starter 2.1 项目创建 2.2 创建Realm 2.3 配置Shiro ...

  5. Spring Boot 基础,理论,简介

    Spring Boot 基础,理论,简介 1.SpringBoot自动装配 1.1 Spring装配方式 1.2 Spring @Enable 模块驱动 1.3 Spring 条件装配 2.自动装配正 ...

  6. OpenStack (haproxy)

    openstack部署脚本 链接:<https://pan.baidu.com/s/1BTp_tGNC6ZWwVmKkhwivgw > 提取码:jxuz haproxy 官网:< h ...

  7. MariaDB数据库 ----数据库简介,用户管理,数据库创建,数据类型、数据增删改(实例演示)

    数据库简介 数据库--即电子文件柜,用户可以对文件中的数据进行增,删,改,查等操作. 数据库分类 关系型数据库 关系型数据库管理系统(Relational Database Management Sy ...

  8. 免费开源的代码审计工具 Gosec 入门使用

    声明: 本教程是在自己的电脑上本地测试Gosec的效果,所以不涉及其他运行模式,如果想要了解其他模式可以关注后期文档,如果想要自定义交流自定义代码扫描规则,可以跟我交流沟通. 背景: Gosec是一个 ...

  9. Eclipse中配置Junit

    在要使用Junit的project名上,点击properties-->Java Build Path-->Libraries,点击Add Library 选择Junit 选择Junit 4 ...

  10. 2288.【POJ Challenge】生日礼物 链表+堆+贪心

    BZOJ2288 [POJ Challenge]生日礼物 题意: 给一个长度为\(n\)的数组,最多可以选\(m\)个连续段,问选取的最大值是多少 题解: 先把连续的符号相同的值合并,头和尾的负数去掉 ...