楼主: Winratschen
1273 10

Learning AngularJS Brad Dayley 2014 [推广有奖]

  • 0关注
  • 0粉丝

本科生

66%

还不是VIP/贵宾

-

TA的文库  其他...

Graphics(數據可視化)

Nonparametric Statistics

Statistics(統計學)

威望
0
论坛币
2176 个
通用积分
3.4200
学术水平
5 点
热心指数
5 点
信用等级
5 点
经验
816 点
帖子
42
精华
1
在线时间
0 小时
注册时间
2015-1-25
最后登录
2017-4-6

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币


  • Learning AngularJS
  • By: Brad Dayley

  • Publisher: Addison-Wesley Professional

  • Pub. Date: December 19, 2014

  • Print ISBN-10: 0-13-403454-6

  • Print ISBN-13: 978-0-13-403454-6

  • Web ISBN-10: 0-13-403514-3

  • Web ISBN-13: 978-0-13-403514-7

  • Pages in Print Edition: 272

  • Subscriber Rating: [0 Ratings]



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Learning earning Learn BRAD ning 2014

本帖被以下文库推荐

沙发
ReneeBK 发表于 2015-10-11 10:15:18 |只看作者 |坛友微信交流群
  1. do/while Loops
  2. Another type of while loop is the do/while loop. This is useful if you always want to execute the code in the loop at least once and the expression cannot be tested until the code has executed at least once.

  3. For example, the following do/while loop executes until days is equal to Wednesday:

  4. Click here to view code image

  5. var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"];
  6. var i=0;
  7. do{
  8.   var day=days[i++];
  9.   console.log("It's " + day);
  10. } while (day != "Wednesday");

  11. This is the output at the console:

  12. It's Monday
  13. It's Tuesday
  14. It's Wednesday
复制代码

使用道具

藤椅
ReneeBK 发表于 2015-10-11 10:15:56 |只看作者 |坛友微信交流群
  1. while Loops
  2. The most basic type of looping in JavaScript is the while loop. A while loop tests an expression and continues to execute the code contained in its {} brackets until the expression evaluates to false.

  3. For example, the following while loop executes until i is equal to 5:

  4. Click here to view code image

  5. var i = 1;
  6. while (i<5){
  7.   console.log("Iteration " + i);
  8.   i++;
  9. }
复制代码

使用道具

板凳
ReneeBK 发表于 2015-10-11 10:17:17 |只看作者 |坛友微信交流群
  1. for Loops
  2. A JavaScript for loop enables you to execute code a specific number of times by using a for statement that combines three statements in a single block of execution. Here’s the syntax:
  3. for (var x=1; x<=3; x++){
  4.   for (var y=1; y<=3; y++){
  5.     console.log(x + " X " + y + " = " + (x*y));
  6.   }
  7. }
复制代码

使用道具

报纸
ReneeBK 发表于 2015-10-11 10:17:52 |只看作者 |坛友微信交流群
  1. for/in Loops
  2. Another type of for loop is the for/in loop. The for/in loop executes on any data type that can be iterated. For the most part, you will use for/in loops on arrays and objects. The following example illustrates the syntax and behavior of the for/in loop on a simple array:

  3. Click here to view code image

  4. var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"];
  5. for (var idx in days){
  6.   console.log("It's " + days[idx] + "<br>");
  7. }
复制代码

使用道具

地板
ReneeBK 发表于 2015-10-11 10:19:54 |只看作者 |坛友微信交流群
  1. Defining Functions
  2. You define a function by using the function keyword followed by a name that describes the use of the function, a list of zero or more arguments in (), and a block of one or more code statements in {}. For example, the following is a function definition that writes "Hello World" to the console:

  3. Click here to view code image

  4. function myFunction(){
  5.   console.log("Hello World");
  6. }

  7. To execute the code in myFunction(), all you need to do is add the following line to the main JavaScript or inside another function:

  8. myFunction();
复制代码

使用道具

7
ReneeBK 发表于 2015-10-11 10:20:39 |只看作者 |坛友微信交流群
  1. Passing Variables to Functions
  2. Frequently you need to pass specific values to functions, and the functions will use those values when executing their code. You pass values to a function in comma-delimited form. A function definition needs a list of variable names in () that match the number being passed in. For example, the following function accepts two arguments, name and city, and uses them to build the output string:

  3. Click here to view code image

  4. function greeting(name, city){
  5.   console.log("Hello " + name);
  6.   console.log(". How is the weather in " + city);
  7. }

  8. To call the greeting() function, you need to pass in a name value and a city value. The value can be a direct value or a previously defined variable. To illustrate this, the following code executes the greeting() function with a name variable and a direct string for city:

  9. var name = "Brad";
  10. greeting(name, "Florence");
复制代码

使用道具

8
ReneeBK 发表于 2015-10-11 10:22:21 |只看作者 |坛友微信交流群
  1. Returning Values from Functions

  2. function formatGreeting(name, city){
  3.   var retStr = "";
  4.   retStr += "Hello <b>" + name + "/n");
  5.   retStr += "Welcome to " + city + "!";
  6. return retStr;
  7. }
  8. var greeting = formatGreeting("Brad", "Rome");
  9. console.log(greeting);

  10. You can include more than one return statement in the function. When the function encounters a return statement, code execution of the function stops immediately. If the return statement contains a value to return, that value is returned. The following example shows a function that tests the input and returns immediately if it is zero:

  11. function myFunc(value){
  12.   if (value == 0)
  13.     return value;
  14.   <code_to_execute_if_value_nonzero>
  15.   return value;
  16. }
复制代码

使用道具

9
ReneeBK 发表于 2015-10-11 10:25:31 |只看作者 |坛友微信交流群
  1. Using Anonymous Functions
  2. For example, the following code defines a function doCalc() that accepts three parameters. The first two should be numbers, and the third is a function that will be called and passed the two numbers as arguments:

  3. function doCalc(num1, num2, calcFunction){
  4.     return calcFunction(num1, num2);
  5. }

  6. console.log( doCalc(5, 10, function(n1, n2){ return n1 + n2; }) );
  7. console.log( doCalc(5, 10, function(n1, n2){ return n1 * n2; }) );
复制代码

使用道具

10
yuyike 发表于 2015-10-11 10:38:52 来自手机 |只看作者 |坛友微信交流群
不错不错

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 23:14