在javascript变量的类型可以是以下这些:
- 函数
- 对象
- 数组
- 字符串
- 数字
- null
那么如何判断一个变量是什么类型呢?
我们可以用typeof来得到变量的类型,例如:
|
|
注意到数组和null被判断成对象类型。
那么怎么判断一个被typeof判断对象的变量的类型,到底是对象,数组,还是null?
1.判断数组,可以用Array.isArray(arr)
2.判断null,可以用Var === null
可以判断变量的类型的方法:
|
|
学习思考成长
在javascript变量的类型可以是以下这些:
那么如何判断一个变量是什么类型呢?
我们可以用typeof来得到变量的类型,例如:
|
|
注意到数组和null被判断成对象类型。
那么怎么判断一个被typeof判断对象的变量的类型,到底是对象,数组,还是null?
1.判断数组,可以用Array.isArray(arr)
2.判断null,可以用Var === null
可以判断变量的类型的方法:
|
|
在所有编程语言里,函数是用来包含需要重复执行的代码块,Javascript也不例外。
Javascript函数可以有0到n个参数。
Javascript函数可以返回一个值或0个值。
在JavaScript里,有两种创建函数的方法法。
|
|
|
|
下面是使用不同类型函数的例子
|
|
|
|
|
|
在javascript中,自执行匿名函数一种随处可见的函数,所以理解它是非常重要的。
它首先建立一个函数表达式,然后立刻执行它。
注意:所有在自执行匿名函数中声明的变量在函数外部都是不可访问的。
|
|
函数在JavaScript中非常重要,它们被当做一等公民,什么是一等公民?就是它们能被赋值给变量,能作为参数传递给另一个函数。
|
|
|
|
Case sensitivity
Whitespace
Semicolon
Automatic Semicolon Insertion
2015年
债:6.13%
300:1.7%
500: 41.45%
标普:6.73
投资收益:14%
2014年 投资收益 28.7%
2013年 投资收益 7.24%
每年末跌的特别多,第二年提高投资比例
将投资组合分布于几种不相关的资产,这样可以提高收益同时降低风险。
国内大型公司股票+国内小型公司股票+国外大型公司股票+纯债
500ETF 510500
300ETF 510300
国债ETF 511010
标普500 513500
纳指ETF 513100
比如上面把资金做5等分分别买上面的基金,年末调整保持这个比例,用涨的多去填补涨的不那么厉害的。
股票基金为例,在市场呈现明显的风格轮动趋势时,大盘蓝筹基金和中小成长风格基金便会呈现负相关性。
但是,当市场处于普涨或者熊市极端,他们就会从负相关性变为正相关;多数情况下,债券基金表现会独立于股票型基金
场内 <ETF联接 < 场外
每年调整,已经解决这个问题
保持持有比例卖出。
国内股票指数
500ETF 510500
300ETF 510300
中国债券
国债ETF 511010
华夏亚债 001021
外国股票指数
标普500 513500
纳指ETF 513100
固定收益类
P2P
万能险
投资组合管理有两种:
主题基金:央企改革,一路一带…
极简投资
从基金成立日开始定投,收益在年化12%
保本就要确定波动率
收益就要确定目标收益率
用最小的波动率获得最大的目标收益率
资产配置可以在不损失目标收益率的情况下有效减低波动率。
所以要做资产配置
不同资产之间的相关性越低,配置组合的波动也就越低。
通过调整不同资产的配置比率,会得到一个目标收益率和潜在波动率性价比最高的结果。
[TOC]
wrote some code and then fixed incorrect things
software was deliverd all at once, in a “big bang”
Waterfall presented a step forward from Code-and-Fix.
Problems:
把英语用起来
能用英文讲就不用中文讲
Input v.s. Output
可理解性输入决定输出的质量
你要写的好就要读的多
战胜performance anxiety
焦虑只会持续几分钟。
系统脱敏
透析口语圈
正向单词&逆向单词
英语思维是个结果,而不是过程,过程还是翻译
口语流利就是词汇的问题 - 逆向透析
判断哪些是无法逆向的,然后查词,查一个,漏一个。
一词多意,选择最好记的一个。
逆透析词汇
五金店
石灰
插座
白水泥
油漆
衣服架
排气扇
热水器
地拖吧
旅游鞋
卫生纸
垃圾铲
垫子
地砖
英文贴纸在家居上
关键在于使用,结合口语圈
保健因素
激励因素
Frederick Herzberg’s
Two-factor theory
模板句用起来,发一个相关评论并用文中一个模板句。
就是为了享受,不是为了学习
为了能唱K, 听历年Billboard Year End.
一个月听一年的Billboard Year End.
找歌单Billboard Year End.
无字幕,可以将理解集中听力上,而不是字幕阅读
从而打开听力通道,培养听力。
书就是用来读,不是用来听。
书面语录音,不自然,比较难懂。
看画面,就能懂意思
听的少,听假英语。
关键还是听力词汇量太少
每天听歌只听美国BILLBOARD HOT 100
每周看1部无字幕英文电影×4周
每天听电台只听韩国KBS English电台
每天看电视只看韩国Arirang电视台
每日专题透析一个英文网页
名词短语可以做主语,宾语,补语。
名词短语= 限定词+形容词+名词
a new book , 三部分,每一部分都可以省略。
名词复数
unmarried men
抽象名词
Honesty Fresh water
专有名词代表独一无二,所以仅不加a(an),暗示有另一个存在,也不加-s。
Genghis Khan Taibei Sunday
补语位置的专有名词,当补语和主语或宾语之间是同等关系时,补语也被当做专有名词
Mr.Chan was CTO of the group.
Clinton made Gorle campaign partner of the Presidential election.
The可视为that或those的弱化。
当上下文有明指或暗示时,表示“那个”的指示功能,就要使用定冠词“the”。
He should be home,I saw light in his house.
turn off the portal light.
专有名词和定冠词是不能并存的,在意义上他们有冲突。
专有名词是世界上独一无二的东西,而定冠词却又明指或暗示有其他的存在。
This is not the John I know.
暗示有另一个John存在
例外不例外
海洋,山川,河流,岛屿被列为例外。
其实他们并不列外,只是省略了第三部分名词的名词短语。
The Pacific (Ocean)
The Atlantic (Ocean)
The Indian Ocean
The Mediterranean (Sea)
The Dead sea
The Alp
The Titanic (ship)
如果把这些名词短语的第三部还原,都是普通名词,可以加定冠词,来指示那个叫什么的海洋,山脉或船。
The United States of America
the United Nations
一、名词短语包括限定词、形容词、名词三部分。任一部分可以省略。
二、如果名词短语不加限定词,是因为该词不适合加a(an
).
三、a(an)是one的弱化结果,the是that/those的弱化结果。
Did he take the reward?
it was offerd to him, but he didn’t take.
latch
He ran to the station, He wanted to catch the train
He ran to the station to catch the train.
I am a dog, My name is Rex.I used to live in a big house with a large garden.I liked to sit outside the front and bark.everytime I wanted to come into the garden I would bark until someone opened the gate. As the neighbours complained about my barks. My master spent weeks training me to press my paw on the latch to let myself in.I am very smart, I soon became an expert at opening the gate.but comparing opening the gate, I prefer to bark for someone to open the gate.so I found another way to do it.as soon as I opens the gate, I comes into the garden and waits until the gate shuts. Then I sits and barks until someone lets me outside, after this I immediately lets myself in and begins barking again.this gave me a great deal of pleasure.but soon my master’s wife found my secret, when she went outside shoping last week.she told this to my master, and then my master removed the gate.I got very anonyed, everytime I barked, no one would open the gate.I was very dissatifeid and left the big house and never come back.
Our neighbour, Max, raised a dog years ago, it was call Rex, Rex used to sit outside the front gate and bark, evertime he wanted to come into the garden he would bark until someone opened the gate, even in the middlenight, I complained of the noisy many times to Max, he gave me a promise that he would sovle this. he spent weeks teaching Rex to open the gate by pressing his paw on the latch. Rex was a smart dog, he soon became an expert at opening the gate.However when I went by the Max’s house last week. I noticed that Rex was barking again, this time he was in the garden and waiting someone to let him outside! I immidately told Max about it. Max got anoyed , he removed the gate. Rex could never bark for someone to open the gate. Rex got anoyed, since then I have never seen Rex.
foretell
I am visiting Mary this evenint
I am a fortune-teller, people call me Madam Bellinsky. I set up a tent in a village fair to make money.
yesterday a man visited me, he came into my tent and I told him to sit down. after he had put some money in my bowl, I looked into a crystal ball and tell him that a relative of his was coming to see him, she would be arriving this eveing and intends to stay for a few days. the moment he went outside, a beautifull woman he knows well would rush toward him, she would speak to him and lead him out of this plase, that is all I said to him.
as soon as he went outside, I totally forgot him and what I said. the following morning, he returned to my tent and told me all I had foretold correctly, as soon as he went outside, his wife hurried towards to him and asked him where he had been hiding, she had been looking for him all the afternoon, she told him that his sister would be here in less than an hour, they had to be at the station to meet her. they were late already. as she walked away, he followed her out of the fare.
my husband believes that fortune can be known by fortune-teller. a few days ago he visited a fortune-teller called Madam Bellinsky at a village fair. he went into the tent. it was dark inside. the fortune-teller told him to sit down, after he had given her some money, she asked him to keep queit while she was working,then she looked into a crystal ball and said: a relative of yours is comming to see you, she will be arriving this eveninng. she intends to stay for a few days. the moment you leave this tent, a woman you know well will rush toward you and speak to you. She will lead you out of this place. that is all. as soon as he went outside, he forgot all about Madam Bellinsky because I hurried towards to him, I had been looking for him for all the afternoon.”where have you been hiding” I asked impationtly. ‘your sister will be here in less than an hour, we must be at the station to meet her. we are late already’. as I walked away, he followed me out of the fair.
distant
that is a distant thing, I can not remember.
How many projects have you completed now?
when I have finished this one, I will have completed ten.
How many books have you read now?
when I have read this one, I will have read 2 books.
I’m an astronaut in USA, I am working at NASA, recently NASA lauched a telescope called Hubble into space. since then there was a trouble wiht the Hublle. the main mirror was fautly, the pictures it sent us were dispointing. so NASA is going to send four astronauts to repair it. the astronauts will take the shuttle Endeavour to the Hubble. the Endeavour will grab and hold the Hubble by a robot-arm while the astronauts repaires the Hubble.of course, the Hubble is outside of the earth’s atmosphere, so it will send us the clearest pictures of the stars and distant galaxies that we have ever seen. it will tell us about the age and size of the universe. by the time your read this, the Hubble will have sent us thousands and thousands of wonderful pictures.
The Hubble was lauched into space on april 20, 1990, since then it has sent us thousands and thousands of wonderful pictures. The hubble is above the earth’s atmophere, so the pictures of the stars and distant galaxies are clearer than we have ever seen. our scientist can figure out the age and size of universe by these pictures. but there was a trouble with the Hubble right from the start, its main mirror has some problems since it was sent into space. so soon we sent four astronauts to repairs it.the shuttle Endeavour took the astronauts to the hubble. While the astronauts was making the neccessary repaires, the shuttle grabed and hold the Hubble.
desolate
some places are desolate in the west of china.
I had been studying for years befor I got this job.
I was living in a tiny village. one year, the forest fire started near our village. the firemen soon came to fight it. the fire was very fiere. after three weeks, the fire finally was under control by the firemen’s effort. but the great trees, which had been covering the ground for miles around, was burnt down, now smoke rose up from the ground over the hills.
the winter was coming, as the rain was heavy in the season, the hills threatoned our village with destruction, for the heavy rain would not only wash away the soil but would cause floods as well. when the fire had been put out, the forest authorites ordered several tons of a sepecail type of grass seed which would grow quickly. the seed was sprayed over the ground in huge quatities by planes. the planes had been planting seed for nearly a month when it began to rain, however, the grass had already taken root. in places of the great tree which had been growing there for centuries, pacthes of green had begun to appear in the blackened soil.
last year we recived a call, there was a fire in the countryside. as soon as we had arrived, we began to fight the fire, the fire was firce. before we could get the fire under control, we had been fighting it for nearly three weeks. this is the longest fire time I had ever seen.
smoke rose up from the groud over the hills. there had been great tree for mils around befor the fire began. the winter was comming, the rain would be very heavy so that the floods would be caused. when we had at last put out the fire, the forest authorites ordered several tons of a special tpye of grass seed. the seed could grow quickly. the seed was sprayed over the ground in huge quatities by planes. the planes had been planting for nearly a month when it began to rain. In place of the great trees which had been growing for centuries, patches of green had begun to appear in the blackened soil.
Jeremy’s view
I have a large circle of friends and I am very popular at parties. everybody admires me for my great sense of humour. everybody, that is. Except my six-year-old daughter, rencently I was asked to make a speech at a wedding reception by one of my closest freinds. this is the sort of thing I love, I prepared the speech carefully and went to the party with Jenny. I had included a large number of funny stories in the speech and, of course, it was great success. as soon as I had finished, Jenny told me that she wanted to go home, I was a little dispointed by this but I did as my daughter asked. on the way home, I asked her if she had enjoyed the speech. to my suprise, she said she hadn’t, then I asked why this was so, she told me that she did not like to see so many people laughing at me.
Jenny’s View
my father has a large circle of freinds and is very popular at parties. everybody admires him for his great sense of humour. except me. recentlly. one of his closest freinds asked him to make a speech at a wedding party, this is the sort of thing he loves. he prepared the speech carefully and went to the party with me. He had included a large number of funny stories and, of course, it was great success. but I felt very embarrassed, everbody had been laughing from the start. as soon as he had finshed, I told him that I wanted to go home. he was a little dispointed by this but he did as I asked. On the way home, he asked me if I had enjoyed the speech, I said I hadn’t, he was so suprise, then asked me why this was so, I told him that I did not like to see so many people laughing at him.
Aime’s view
I am Aime from french. I am engneer. in 1858, I arrived in England. I had a plan for a twenty-one miles tunnel under the English Channel. in this plan a platform was possible to build in the center of the tunnel. it would serve as a port and railway station. the tall chimneys would be built above the sea level to make the tunnel well-ventilated. but the british thought my plas was not good enough. two year later, a better plan was put forwardd by an Englishman, Williams Low. He said a double railway shoud be built. it would sovle the problem of ventilation. for when a train enterd the tunnel. it would draw in fresh air behind it. though the plan was perfect, the tunnel was actually begun forty two years later. soon it was stoped, for the war began, the british feard the invasion. until I died I could not see the tunnel was begun again.
William’s View.
The Engish Channel is twenty-tow miles from Britain to French. It was possible to build a tunnel under it. recenlty a French engneer called Aime came to English with a plan for the tunnel. He suggested that it would be possible to build a platform in the centre of the Channel. Tall chemneys above the sea level would be built to sovle the problems of the ventilation. but the british did not agree the plan, for it is not posibble to build a lot of chimneys above the sea. Based on Aime’s plan, I designed another plan. in my plan I suggested that we should built a double railways. it would make the tunnel well-ventilated. because the trains would bring fresh air into the tunnel when it entered the tunnnel. but they refused my plan neither. forty-two years later a tunnel was begun, if the warfare had not begun and the british had not been afraid of the invasion, it would have been completed and conneted Britain and the European continent.
twenty-six years ago, a Lancaster bomber crashed on Wallis island in the south Pacific, the island is remote and a long way west of Samoa.
but over the years. the crash was forgotten and the wreck remained undisturbed. but the plane was accidentally rediscovered in an aerial survey of the island. By this time, a Lancaster bomber in reasonalbe condition was rare and worth rescueing. The French authorities had the plane packaged and moved in parts back to France. a group of enthusiasts are going to have the plane restored, it has four Rolls-Royce Merlin engines, but the group will need to have only three of them rebuilt. Imagine thier suprise and delight when they broke open the packing cases, the fourth engine was sweet as honey– still in perfect condition, a colony of bees had turned the engine into a hive and it was tottaly preserved in beeswax.