千天计划之第971天
One way to keep momentum going is to have constantly greater goals.
5.40起。
因昨晚随意翻看了一篇关于口语全英文学习文章随笔,作者鼓励用英语留言,然后我就说了很长的一段话........
这是原文链接:http://mp.weixin.qq.com/s/-AwsxzIRlcBKeAnn4sDQcA
我关注的几个英语微信公众号之一,其次还有:
教书匠小夏
清晨朗读会
英语学习笔记
FreeGit潇洒毅行
英文杂志
当然还有其他的,但这些是我每天必看的,或者是非常优质的文章,因为题注都是很优秀的人,要么是留学硕士,要么是英语专业,要么是外国人,所以就业推荐给你,希望你找到喜欢的并坚持下去。
第一题作业:
Looping a triangle
output the following results
# ## ### #### ##### ###### #######
var abc = "abc";console.log(abc.length);// → 3
原文链接:http://eloquentjavascript.net/02_program_structure.html
(下拉到底,在最下面)
想了下,还是慢慢写出来,自己分析下这道题吧。
需要循环七次
每次输出一个#
且个数递增
输出一次后换行
那么:
就要用到循环
还有string
个数递增会用到提示里的
abc.length
“引号中的/之后有不同意义,尽管还是引号内的一部分,比如引号中的/n代表引号中的换行,引号中的/t代表引号中的tab charater。”
先看第一步;
循环有三种情况:
do loop ——while
for loop
switch
可能用到break
需要实时更新计数变量和存储变量
应该尽量succinctly(简洁地)
第二步:
每次输出一个#
那就是输出一个变量所包含的值
个数递增则是i++
输入一次换行则是
像这样:
"This is the first line\nAnd this is the second"
This is the first line And this is the second
第三步:
开始尝试编写
仿照前面的循环例子
我挑选了第三章的几个程序,然后都看一下,就会有个大概印象:
直接输出变量的
var x = 30;
console.log("the value of x is", x);
// → the value of x is 30
选用else if的
var theNumber = Number(prompt("Pick a number", ""));
if (!isNaN(theNumber))
alert("Your number is the square root of " + theNumber * theNumber);
else alert("Hey. Why didn't you give me a number?");
var num = Number(prompt("Pick a number", "0"));
if (num < 10) alert("Small");
else if (num < 100) alert("Medium");
else alert("Large");
while语句
var number = 0;
while (number <= 12)
{ console.log(number);
number = number + 2; }// → 0// → 2// … etcetera
var result = 1;
var counter = 0;
while (counter < 10)
{ result = result * 2; counter = counter + 1; }
console.log(result);// → 1024
do { var yourName = prompt("Who are you?"); }
while (!yourName);console.log(yourName);
简洁的for 循环语句
for (var number = 0; number <= 12; number = number + 2)
console.log(number);// → 0// → 2// … etcetera
for (var current = 20; ; current++)
{ if (current % 7 == 0)
break; }
console.log(current);// → 21
题目下面还有个提示,但是我想先做点再看看。
时间到了,下课。
去吃早饭~~
书评那篇以及新的一篇书评,放到晚上或者明晚吧,给它预留的时间昨天被占据了==||