javascript coding bootcamp

Want to know javascript coding bootcamp? we have a huge selection of javascript coding bootcamp information on alibabacloud.com

"Learning Notes" JavaScript coding specification-Comments

Multiline comments using/**......*/, you need to include a description, a value for the specific type of all parameters, and a return value.bad//make () returns a new element//based on the passed in tag name////@param {String} tag//@return {element} elemen Tfunction make (TAG) {//... stuff...return element;} good/*** make () returns a new element* based on the passed in tag name** @param {String} tag* @return {element} element */function make (TAG) {//... stuff...return element;}Single-line comm

"Notes" JavaScript coding specification-commas and semicolons

Do not use commas before statements.Badvar stories = [Once, upon, atime];//goodvar story = [Once,upon,atime];Do not have extra commas: this can cause problems in IE6, IE7, and IE9 's weird patterns, and in some implementations of ES3, extra commas increase the length of the array. Clarified in ES5 (source)Badvar hero = {firstName: ' Kevin ', lastName: ' Flynn ',};var heroes = [' Batman ', ' Superman ',];//goodvar hero = {firstName: ' Kevin ', lastName: ' Flynn '};var heroes = [' Batman ', ' Supe

"Notes" JavaScript coding specification-naming conventions

method facilitates the stack traceBadvar log = function (msg) {Console.log (msg);};/ /goodvar log = function log (msg) {Console.log (msg);};If the file is exported as a class, the filename should be consistent with the class nameFile Contentsclass CheckBox {//...} Module.exports = checkbox;//in some other file//badvar checkbox = require ('./checkbox ');//Badvar checkbox = require ('./ Check_box ');//Goodvar CheckBox = require ('./checkbox ');1:15 and let them is for lights in the firmament of t

"Learning Notes" JavaScript coding specification-statement block

Use curly braces on multiple lines of statement blocksBADIF (test) return False;//goodif (test) return False;//goodif (test) {return false;} Bad function () {return false;};/ /goodfunction () {return false;}For multi-line statement blocks that use if and else, place the else and if statement block left curly braces on the same line.BADIF (test) {A (); B ();} Else{c ();} GOODIF (test) {A (); B ();} Else{c ();} God Bless!"Learning Notes" JavaScript

"Learning Notes" JavaScript coding specifications-Comparison operators & equality

Use = = = and!== instead of = = and! =Comparison operators perform calculations using the ToBoolean method to cast the data type and follow these rules:The computed value of object is TrueThe computed value of undefined is falseBoolean evaluates to a Boolean valueNumbers if it is -0,+0 or Nan, the computed value is false and the inverse is truestring if NULL, the computed value is false and vice versa is trueif ([0]) {//true}Using shortcutsBADIF (Name!== ") {}//goodif (name) {}//badif (collectio

"Learning Notes" JavaScript coding specification-arrays

Creating an array using literal syntaxGoodvar items = [];//badvar items = new Array ();When you need to add an array element, use push instead of directly addingvar items = [];//gooditems.push (' abc ');//baditems[items.length] = ' abc ';When you need to copy an array, you can use slice.var len = items.length; var itemscopy = [];var i; Gooditemscopy = Items.slice ();//badfor (i=0;iTo convert a class array object to an array using slicefunction Trana () { var args = Array.prototype.slice.cal

201505061055_ "JavaScript Coding specification Notes"

if...else... , and try...catch...finally so on, it is recommended to } add a newline style after the tail numberif (condition) {//dosomething ...}else { //dosomething ...};3.5 End of function definition does not allow the addition of semicolonsFor example: function () {Dosometing}Three. naming3.1 变量 use Camel命名法 ;常量 全部字母大写,单词间下划线分隔 The naming method used by 3.2;3.3 类 use Pstringascal命名法 ; for example: Catclass;3.4 枚举变量 Use Pascal命名法 , 枚举的属性 全部字母大写,单词间下划线分隔 The use of the naming method;3.5 命名空间

Summary of basic JavaScript coding modes

No matter how you write a program, you will be exposed to the coding style, design patterns, and other concepts. The encoding style is generally focused on writing specifications, while the design pattern is biased towards programming architecture design. The "Patterns" I have compiled in this article include some common methods or tips for writing JavaScript code, which can help beginners who are new to

"Notes" JavaScript Coding specification-Events & Modules

version.At the top of the module, declare ' use strict ';Fancyinput/fancyinput.js!function (Global) {' Use strict '; var previousfancyinput = Global. Fancyinput;function fancyinput (options) {this.options = Options | | {};} Fancyinput.noconflict = function noconflict () {Global. Fancyinput = Previousfancyinput;return fancyinput;}; Global. Fancyinput = Fancyinput;} (this);Genesis 1:18 and rule over the day and over the night,and to divide the light from the Darkness:and of God saw that it's was

Total Pages: 4 1 2 3 4 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.