JavaScript from jQuery

  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
  13. 1
  14. 1
  15. 1
  16. 1
  17. 1
  18. 1
时间: 2024-11-06 10:15:07

JavaScript from jQuery的相关文章

【JavaScript】jQuery Ajax 实例 全解析

jQuery确实是一个挺好的轻量级的JS框架,能帮助我们快速的开发JS应用,并在一定程度上改变了我们写JavaScript代码的习惯. 废话少说,直接进入正题,我们先来看一些简单的方法,这些方法都是对jQuery.ajax()进行封装以方便我们使用的方法,当然,如果要处理复杂的逻辑,还是需要用到jQuery.ajax()的(这个后面会说到). 1. load( url, [data], [callback] ) :载入远程 HTML 文件代码并插入至 DOM 中. url (String) :

【Javascript】jQuery Validate扩展验证方法

/*****************************************************************jQuery Validate扩展验证方法*****************************************************************/// 判断整数value是否等于0 jQuery.validator.addMethod("isIntEqZero", function (value, element) { valu

bootstrap下拉框的例子,提示Error: Bootstrap's JavaScript requires jQuery

bootstrap很多js依赖jquery,所以需要引入jquery 遇到的问题: 页面访问提示:Error: Bootstrap's JavaScript requires jQuery 解决方法: 在引入bootstrap的js文件之前,先引入jquery.js 导入顺序可以向下面一样 <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script><link rel

为什么原生 JavaScript 开发越来越多受欢迎?是否应该跟风用原生JavaScript代替 jQuery等库?

本文标签:  jQuery的作用 原生JavaScript优势 jQuery官网 jQuery处理DOM和跨浏览器 JavaScript新特性 互联网杂谈 随着 JavaScript 本身的完善,越来越多的人开始喜欢使用原生 JavaScript 开发代替各种库,其中不少人发出了用原生 JavaScript 代替 jQuery 的声音.这并不是什么坏事,但也不见得就是好事.如果你真的想把 jQuery从前端依赖库中移除掉,我建议你慎重考虑. 首先 jQuery 是一个第三方库.库存在的价值之一在

通过javascript库JQuery实现页面跳转功能代码

通过javascript库JQuery实现页面跳转功能代码的四段代码实例如下. 实例1: 1 2 3 4 $(function(){ var pn = $("#gotopagenum").val();//#gotopagenum是文本框的id属性 location.href = "NewList.aspx?pagenum="+pn;//location.href实现客户端页面的跳转 }); 实例2: 实现跳转:window.location = 'user!add.

javascript 与 jquery 中的函数调用的区别

标签:例如<input id="btn_show" type="button" onclick="show()" /> <script type="text/javascript"> $(function(){ function show(){ -- } }) function show(){ -- } </script> 注意, 此时button的点击事件不会调用jquery中的show(

Javascript或jQuery方法产生任意随机整数

方法1:javascritp方法 1 2 3 4 5 6 //随机数    function diu_Randomize(b,e){        if(!b && b!=0 || !e){return "?";}        return Math.floor( ( Math.random() * e ) + b );    }    $(window).load = $(".ps"+diu_Randomize(1,12)).show();//1

JavaScript和JQuery获取DIV的值

1.设计源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C

解决【Bootstrap&#39;s JavaScript requires jQuery】的问题

楼主现在在自学boostrap,就遇到了一个初学者可能遇见的问题.报了这个错误Bootstrap's JavaScript requires jQuery 提示是第6行报错.但是,楼主却发现第6行是链接.链接的名字也没出错.后来,楼主才发现是顺序的问题. 解决方法:1,文件引入的先后顺序,应该先引入jquery再引入bootstrap,也就是把这两个文件的出现顺序换一下. 2,如果不是顺序问题的话那就是版本的问题.请引入更高级的jquery版本. 解决[Bootstrap's JavaScrip

四种常见的提示弹出框(success,warning,error,loading)原生JavaScript和jQuery分别实现

虽然说现在官方的自带插件已经有很多了,但是有时候往往不能满足我们的需求,下面我简单介绍一些 常见的四种提示弹出框(success,loading,error,warning),我分别用原生JavaScript和jQuery来介绍分享给各位博友! 一.首先介绍原生JavaScript来实现四种提示弹出框: 第一步:先看看html的建立 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http: