获得从零开始倒计时的功能 [英] Get a function to countdown from zero

查看:92
本文介绍了获得从零开始倒计时的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// countDown接收一个大于0的数字

//它将从输入开始的每个数字记录为0

//没有返回值

//示例:countDown(3)记录以下内容

// 3

// 2

// 1

// 0



我的尝试:



 function countDown(start){
if(start> 0)
var sum = start-1;

console.log(sum);

解决方案

循环播放JavaScript [ ^ ]

// countDown takes in a number greater than 0
// it logs every number starting from the input down to 0
// there is no return value
// Example: countDown(3) logs the following
// 3
// 2
// 1
// 0

What I have tried:

function countDown(start) {
if(start>0)
  var sum = start-1;

   console.log(sum);

解决方案

JavaScript while Loop[^]


这篇关于获得从零开始倒计时的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆