Write down your solution for this assignment, take a picture and submit on canvas. Typed answers are not graded.
var globalVar =1;
function foo(argVar){
var localVar=2;
return function(arg){
argVar +=arg;
localVar += arg;
globalVar += arg;
console.log('F', argVar, localVar, globalVar);
};
}
var func1 = foo(1);
var func10 = foo(10);
func1(1);
func10(2);
console.log('G', globalVar);
OUTPUT:
"F" 2 3 2
"F" 12 4 4
"G" 4
EXPLAINATION:
var func1= foo(1)
foo(1)
local var=2
fun(1)
argvar+=arg (1+1=2) :argvar =2
localvar+=arg (2+1) : localvar=3
globalvar+=arg (1+1) : globalvar=2
fun(10)
10+2=12 (because localvar is 2 so arg change into 2)
2+2=4
2+2=4
func1(1); //will not execute
func10(2); //will not execute
console.log('G', globalVar);
4
Write down your solution for this assignment, take a picture and submit on canvas. Typed answers...
Write a WebGL program that displays a rotating pendulum. The pendulum bob is free to rotate through 360 degrees about an anchor point at the center of the canvas. The pendulum has the following three components. 1) The anchor point is a green square centered at the origin (0,0) with point size = 5 pixels. 2) The bob is a blue hexagon of radius r = 0.1. Render this with a triangle fan centered at the origin (along with a...
Assignment Overview In Part 1 of this assignment, you will write a main program and several classes to create and print a small database of baseball player data. The assignment has been split into two parts to encourage you to code your program in an incremental fashion, a technique that will be increasingly important as the semester goes on. Purpose This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of...
Code is in C#
Your instructor would like to thank to Marty Stepp and Hélène Martin at the University of Washington, Seattle, who originally wrote this assignment (for their CSE 142, in Java) This program focuses on classes and objects. Turn in two files named Birthday.cs and Date.cs. You will also need the support file Date.dll; it is contained in the starter project for this assignment. The assignment has two parts: a client program that uses Date objects, and a...