下面两个函数的返回值是一样的吗?为什么?
-
function foo1 () {
-
return {
-
bar: "hello"
-
};
-
}
-
-
function foo2 () {
-
return
-
{
-
bar: "hello"
-
};
-
}
不一样,第一个返回的是object,第二个返回的是undefined
return 、break、continue 等语句,如果后面紧跟换行,解析器一定会自动在后面填充分号(;)
MySQL
-
CREATE TABLE student_score(
-
name VARCHAR( 20),
-
course VARCHAR( 10),
-
score INT( 10)
-
);
-
-
INSERT INTO student_score VALUES( '张三', '语文', 81);
-
INSERT INTO student_score VALUES( '张三', '数学', 75);
-
INSERT INTO student_score VALUES( '李四', '语文', 76);
-
INSERT INTO student_score VALUES( '李四', '数学', 90);
-
INSERT INTO student_score VALUES( '王五', '语文', 81);
-
INSERT INTO student_score VALUES( '王五', '数学', 100);
-
INSERT INTO student_score VALUES( '王五', '英语', 90);
-
-
SELECT name FROM student_score GROUP BY name HAVING MIN(score)> 80;
Java
-
package test;
-
-
public class Client1 {
-
public static double sumBallHeight(double h, int n) {
-
if (n == 1)
-
return h / 2;
-
else
-
return sumBallHeight(h / 2, n - 1);
-
}
-
-
public static void main(String[] args) {
-
System.out.println(sumBallHeight( 100, 10));
-
}
-
}