This is a discussion on How is JavaScript syntax like C / C++? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all....... How is JavaScript syntax like C / C++? Thanks & Regards itbarota....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all..... The languages have enough in common to make learning one easy if you know the other. By the same token, the differences are subtle enough to trip up those proficient in both. Here's a short list comparing C and javascript: * Terminating JavaScript command lines in semicolons is optional; in C it's mandatory. Recommended practice is to use them religiously in both languages (and Java as well). * Both JavaScript and C are case-sensitive; 'doThis' is different from 'DOTHIS'. Experienced programmers learn to love this feature, which drives beginners nuts. * Both JavaScript and C are block-structured computer languages and employ curly brackets -- '{' and '}' -- to delimit blocks. * Both JavaScript and C employ quotation -- enclosure in single or double quote marks -- to designate text strings. * Arrays in both JavaScript and C are zero-based; the first element is myArray[0], not myArray[1]. * Both JavaScript and C employ '==' for comparison, '=' for equality, and '!' for negation. In fact the set of JavaScript operators is essentially borrowed from C (right down to the deprecated ternary construct a ? b : c). * Both JavaScript and C employ the symbols /* to designate a comment */. JavaScript also permits the use of '//' for short comments, as in C++. Finally, JavaScript's statements are a strict subset of C++'s, offering a smaller selection of identical looping and conditional constructs. Thanks....... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Php Basic Syntax of Regular Expressions | senraj | PHP Programming | 12 | 02-08-2008 08:29 PM |
| How does JavaScript Reporter differ from JavaScript editors? | Pvinothkumar | HTML, CSS and Javascript Coding Techniques | 1 | 09-13-2007 05:59 AM |
| What is the syntax for TextOut function in VC++ Win32 application? | mobilegeek | C and C++ Programming | 3 | 08-09-2007 03:23 AM |
| Oracle Cluster - Create and Alter Basic Syntax | Murali | Database Support | 2 | 07-11-2007 06:40 AM |
| Python resemble in its class syntax with other languages | vigneshgets | Python | 1 | 05-27-2007 11:01 PM |