Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary - CGS3066: Web Programming and Design Summer 2014

Rating
-
Sold
-
Pages
24
Uploaded on
08-07-2024
Written in
2023/2024

. high-level, dynamic, untyped, and interpreted programming language ... is prototype-based with first-class functions, … ... supporting object-oriented, imperative, and functional programming ... has an API for working with text, arrays, dates and regular expressions ● Not particularly similar to Java: More like C crossed with Self/Scheme ○ C-like statements with everything objects, closures, garbage collection, etc. ● Also known as ECMAScript 2 CS142 Lecture Notes - JavaScript Basics Some thoughts about JavaScript ● Example of a scripting language ○ Interpreted, less declaring of things, just use them (popular today: e.g. python) ● Seems like it was designed in a rush ○ Some “Good Parts”, some not so good ○ Got a bad reputation ● Many programmers use a subset that avoids some common problems ● "use strict"; tweaks language to avoid some problematic parts ● Language being extended to enhance things: New ECMAScript every year! ○ Transpiling common so new features used: e.g ECMAScript Version N, TypeScript ● Code quality checkers (e.g. jslint, jshint, eslint) widely used 3 CS142 Lecture Notes - JavaScript Basics Good news if you know C - JavaScript is similar i = 3; i = i * 10 + 3 + (i / 10); while (i = 0) { sum += i*i; // Comment i--; } for (i = 0; i 10; i++) { } /* this is a comment */ 4 if (i 3) { i = foobar(i); } else { i = i * .02; } Most C operators work: * / % + - ! = = && || ?: function foobar(i) { return i;} continue/break/return CS142 Lecture Notes - JavaScript Basics JavaScript has dynamic typing var i; // Need to define variable ('use strict';), note: untyped typeof i == 'undefined' // It does have a type of ‘undefined’ i = 32; // Now: typeof i == typeof 32 == 'number' i = "foobar"; // Now: typeof i == typeof 'foobar' == 'string' i = true; // Now typeof i == 'boolean' ● Variables have the type of the last thing assigned to it ● Primitive types: undefined, number, string, boolean, function, object 5 CS142 Lecture Notes - JavaScript Basics Variable scoping with var: Lexical/static scoping Two scopes: Global and function local var globalVar; function foo() { var localVar; if (globalVar 0) { var localVar2 = 2; } // localVar2 is valid here } 6 All var statements

Show more Read less
Institution
CGS3066: Web Programming And Design Summer 2014
Course
CGS3066: Web Programming and Design Summer 2014










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CGS3066: Web Programming and Design Summer 2014
Course
CGS3066: Web Programming and Design Summer 2014

Document information

Uploaded on
July 8, 2024
Number of pages
24
Written in
2023/2024
Type
SUMMARY

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
leonardkinyua

Get to know the seller

Seller avatar
leonardkinyua Abraham Lincoln University, School Of Law
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
323
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions