博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JavaScript from jQuery
阅读量:6892 次
发布时间:2019-06-27

本文共 6123 字,大约阅读时间需要 20 分钟。

  1. http://learn.jquery.com/javascript-101/types/
    1. primitives
      1. String: “”,‘’,\
      2. Number: integer and floating point
      3. Boolean:true or false
      4. Null:null
      5. Undefined:undefined
    2. objects
      1. Object:object literal {:,:},unordered key and value pairs,key is formally known as a property and the value can be any valid JavaScript type, even another object. To create or access a property on an object, we use what is known as "dot notation" or "bracket notation."
      2. Array:ordered by the index of each item it contains.The index starts at zero and extends to however many items have been added, which is a property of the array known as the .length. Similar to a basic object, an array can be created with the Array constructor or the shorthand syntax known as array literal [].
      3. Function
    3. Type Checking with jQuery
      1. ===
      2. typeof
      3. jQuery.isFunction( myValue ); // false
        jQuery.isPlainObject( myValue ); // false
        jQuery.isArray( myValue ); // true
  2. http://learn.jquery.com/javascript-101/operators/
    1. Operations on Numbers & Strings
    2. Logical Operators
    3. Comparison Operators
  3. http://learn.jquery.com/javascript-101/conditional-code/
    1. Falsy Things:
      // Values that evaluate to false:
      false
      "" // An empty string.
      NaN // JavaScript's "not-a-number" variable.
      null
      undefined // Be careful -- undefined can be redefined!
      0 // The number zero.
    2. Truthy:
       // Everything else evaluates to true, some examples:
      "0"
      "any string"
      [] // An empty array.
      {} // An empty object.
      1 // Any non-zero number.
    3. Conditional Variable Assignment with the Ternary Operator
    4. Switch Statements
  4. http://learn.jquery.com/javascript-101/loops/
    1. for ( [initialization]; [conditional]; [iteration] ) {
       
      [loopBody]
       
      }
    2. while ( [conditional] ) {
       
      [loopBody]
       
      }
    3. do {
       
      [loopBody]
       
      } while ( [conditional] )
    4. Breaking and Continuing
  5. http://learn.jquery.com/javascript-101/reserved-words/
    1. break case catch class const continue debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield
  6. http://learn.jquery.com/javascript-101/arrays/
    1. Arrays are zero-indexed(从0开始索引), ordered lists(保留原始的入栈顺序) of values. 
    2. .sort(): 排序之后原来的数组已被改变,Sorts an array. It takes one parameter, which is a comparing function. If this function is not given, the array is sorted ascending.The return value of descending (for this example) is important. If the return value is less than zero, the index of a is before b, and if it is greater than zero it's vice-versa. If the return value is zero, the elements' index is equal.
    3. .forEach(): The function takes up to three arguments:
      1. Element – The element itself.
      2. Index – The index of this element in the array.
      3. Array – The array itself. All of these are optional
    4. .unshift(): Inserts an element at the first position of the array
    5. .shift() Removes the first element of an array.
    6. splice():部分元素替换, Removes a certain amount of elements and adds new ones at the given index. It takes at least three parameters: 1 myArray.splice( index, length, values, ... ); Index – The starting index. Length – The number of elements to remove. Values – The values to be inserted at the index position.
    7. .slice():提取从index开始到最后的部分, Extracts a part of the array and returns that part in a new array. This method takes one parameter, which is the starting index:
    8. reverse():倒序之后原来的数组已被改变, the elements of the array are in reverse order after calling this method
    9. .push(): is a function that adds an element on the end of the array and expands the array respectively.
    10. .pop() : removes the last element of an array. It is the opposite method of .push()
    11. .join() creates a string representation of an array by joining all of its elements using a separator string
    12. Concatenate two or more arrays with .concat():
    13. .length property is used to determine the amount of items in an array
  7. http://learn.jquery.com/javascript-101/objects/
    1. Objects contain one or more key-value pairs. The key portion can be any string. The value portion can be any type of value: a number, a string, an array, a function, or even another object. When one of these values is a function, it’s called a method of the object. Otherwise, they are called properties.
  8. http://learn.jquery.com/javascript-101/functions/
    1. // Function declaration.
      function foo() {
      // Do something.
      }
    2. // Named function expression.
      var foo = function() {
      // Do something.
      };
    3. // A simple function.
    4. // A function that returns a value.
    5. // A function that returns another function.
    6. Immediately-Invoked Function Expression (IIFE):
      (function() {
      var foo = "Hello world";
      })();
    7. Functions as Arguments
  9. http://learn.jquery.com/javascript-101/testing-type/
    1. var myRegExp = /(\w+)\s(\w+)/;
    2. if ( Object.prototype.toString.call( myArray ) === "[object Array]" ) {
      // Definitely an array!
      // This is widely considered as the most robust way
      // to determine if a specific value is an Array.
      }
  10. http://learn.jquery.com/javascript-101/this-keyword/
    1. this is a special keyword that is used in methods to refer to the object on which a method is being invoked
      • If the function is invoked using Function.call() or Function.apply()this will be set to the first argument passed to .call()/.apply(). If the first argument passed to .call()/.apply() is null or undefinedthis will refer to the global object (which is the window object in web browsers).
      • If the function being invoked was created using Function.bind()this will be the first argument that was passed to .bind() at the time the function was created.
      • If the function is being invoked as a method of an object, this will refer to that object.
      • Otherwise, the function is being invoked as a standalone function not attached to any object, and this will refer to the global object.
  11. http://learn.jquery.com/javascript-101/scope/
    1.  In a browser, the global scope is the window object
  12. http://learn.jquery.com/javascript-101/closures/
    1. Closures are an extension of the concept of scope
    2. for(var i=0;i<5;i++){console.log(i+" : before");setTimeout(function(){console.log(i + " "+new Date());},i*1000);console.log(i+" : after")}

转载于:https://www.cnblogs.com/dmdj/p/4149297.html

你可能感兴趣的文章
npm install 时间很长解决方案
查看>>
搭建maven环境
查看>>
中国大学MOOC-C程序设计(浙大翁恺)—— 时间换算
查看>>
爬豆瓣电影名
查看>>
深度学习之各种网络结构
查看>>
leetcode20: Insert Interval
查看>>
GNU make: Learning notes
查看>>
泛型程序设计---泛型方法的定义
查看>>
一个“MacBook”新手的Python“笨办法”自学之旅 #第九章:Python的函数
查看>>
codetest
查看>>
自己实现文本相似度算法(余弦定理)
查看>>
卡尔曼滤波小结
查看>>
Windows Server 2008 R2 负载平衡入门篇
查看>>
前后端联调
查看>>
OpenCV与QT联合编译 分类: Eye_Detection ...
查看>>
LNMP架构介绍
查看>>
洛谷3986
查看>>
ssh服务
查看>>
Eclipse的基本使用
查看>>
构建之法 第五章 团队和流程
查看>>