2014年9月26日 星期五

2014/9/26 今日學習

W3School

Arrays 


  • The easiest way to add a new element to an array is to use the length property:
example
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits[fruits.length] = "Lemon";     // adds a new element (Lemon) to fruits


  • 發現一件有趣的,可以在<script>的變數裡設定<ul>
  • 滿有趣的範例code,可以了解如何用array寫一個list

When to Use Arrays? When to use Objects?

  • JavaScript does not support associative arrays
  • You should use objects when you want the element names to be strings.
  • You should use arrays when you want the element names to be sequential numbers.
Avoid new Array(). Use [] instead.
The new keyword complicates your code and produces nasty side effects


How to Recognize an Array?

A common question is: How do I know if a variable is an array?
The problem is that the JavaScript operator typeof returns "object"

---05:26pm停頓休息來玩Dash---

Dash 

Project 2.2

<article>
margin 邊
margin: 0 auto;  // set margin to "0 auto", it has 0 margin on the top and bottom, and "auto" margin on left and right.

media query
@media (條件){
     發生的事
}

hex color,example: #F00,都會有hash"#"這符號
在CSS裡控制color可以用hex color或是rgba(),example:  background: rgba(0, 0, 0, 0.5);
rgba(R, G, B, transparency),transparency透明度


題外話
Inside the function, the arguments are used as local variables.

    沒有留言:

    張貼留言