This document provides an overview of JavaScript for developers familiar with Visual FoxPro (VFP). It compares the runtime environments, development environments, capabilities, syntax, operators, and constructs between VFP and JavaScript. Key differences highlighted include JavaScript running in browsers across operating systems, its lack of file system access, and event-driven model compared to VFP's compiled runtime. The document aims to ease the transition for VFP developers by pointing out similarities in syntax and highlighting where JavaScript's prototype-based object model differs from VFP's class-based approach.
4. Why JavaScript?
• Web 2.0
• Great way to take VFP Skills to the Web
• In demand
• Cross-Platform
• Relatively easy for VFP Developers to pick
up
5. VFP vs. JavaScript: Runtime
Environment
VFP JavaScript
– Operating System: – Operating System:
• Windows • Windows, MAC, Linux,
Version: Unix, etc.
• VFP Compiler Version Version:
• Browser Controlled: IE,
Firefox, Opera, Safari,
etc.
• 1.5 current “standard”
6. VFP vs. JavaScript: Development
Environment
VFP JavaScript
– Designers: Editor, Form – Designers: n/a, Requires 3rd
Class Designer, Report Party tools. No definitive
Write, Class Browser, etc. IDE
built-in. – Debugger: virtually nothing
– Debugger: Integrated native. Varies by browser,
debugger, with Trace, Firebug for Firefox and
Watch, Locals, Output, Call Debugbar for IE.
Stack – JavaScript Console various
– Command Window other Command Window
like utilities.
7. VFP vs. JavaScript: Capabilities
VFP JavaScript
– Access to File System – No File System
– Database Engine Access
– Network access – Can’t read or write to
limited only by network files on server
security – Can’t read or write to
files on client
– No network access
– Cannot access pages
on another domain
8. VFP vs. JavaScript: Language
Features
VFP JavaScript
– Dynamically Typed – Dynamically Typed
– Case Insensitive – Case Sensitive
– “Second Class” – First Class Functions
Functions – Nested Functions
– No Nested Functions – Interpreted
– Compiled or – OOP: Prototype based
Interpreted – “0 based”
– OOP: Class Based
– “1 based”
9. Syntax
VFP JavaScript
– Line Terminator: – Line Terminator: semi-
carriage return colon
– Line Continuation: – Line Continuation: n/a
semi-colon
12. Comparison Operators
Function VFP JavaScript
Equality =,== ==
Greater than >, >= >, >=
Less Than <, <= <, <=
Identical & of n/a ===
Same Type
Not Identical !=,!==,<> !==
Inline IF IIF() (condition)?true
value: false
value