1 / 8

javascript

javascript. A Simple Overview. Outline. Definition & Guidelines Special Characters Conversion of Variables Pass by Value Pass by Reference Websites. Definition & Guidelines. Javascript is a scripting language It does not have to complied like Java, C, or C++

dewei
Télécharger la présentation

javascript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. javascript A Simple Overview

  2. Outline • Definition & Guidelines • Special Characters • Conversion of Variables • Pass by Value • Pass by Reference • Websites

  3. Definition & Guidelines • Javascript is a scripting language • It does not have to complied like Java, C, or C++ • It is usually embedded in html pages • Guidelines • It is Case Sensitive • White Space is ignored • A backslash (\) breaks up a line • Special Characters also use the backslash

  4. Special Characters

  5. Conversion of Varaibles • Number to a String • aString= aNumber+'' • aString = Math.PI+ '' • aString= aNumber.toString() • aString= (3.14).toString() • String to a Number • parseFloat('0.1e5') // 10000 • parseFloat('.5') // 0.5 • parseFloat('3.7lbs') // 3.7 • parseInt('23') // 23 • parseInt('100.55') // 100 • parseInt('025',10) // 25 • parseInt('22',8) // 18 (= 2*8 + 2)

  6. Pass By Value • Value is passed in by value • Changes to avariable while in afunction does not change the variable outside the function function passValue(xValue) { // xValue=1 xValue = 5; // xValue=1 } varxValue = 1; alert(xValue); // xValue=1 passValue(xValue); alert(xValue); // xValue=1

  7. Pass By Reference • An object is passed in by reference • object properties are accessible within the function so value of the object can be changed in the function function Aobject() { this.value = 10; } var x = new Aobject(); alert(x.value); // x.value = 10 function Editobject(Fobject) { Fobject.value = 12; } Editobject(x); alert(x.value); // x.value is now equal to 12

  8. Websites • http://www.w3schools.com/js/ • http://www.javascripter.net/faq/

More Related