




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Unit I - Basics of JavaScript Programming TEACHING HOURS – 10 TOTAL MARKS – 12 Course Outcome (CO-1) – Create interactive web pages using program flow control Structure.
1. What is JavaScript? State the need of JavaScript. Explanation - JavaScript is a programming language for webpage which is used both on the client- side and server-side that allows you to make web pages interactive. Need of JavaScript - - JavaScript can calculate , manipulate and validate data. - Where HTML and Cascading Style Sheet (CSS) are languages that give structure and style to web pages, JavaScript gives web pages interactive elements that engage a user. 2. Write Any Four Applications of JavaScript – Explanation – - Adding interactive behavior to web pages – o Show or hide more information with the click of a button o Change the color of a button when the mouse hovers over it o Slide through a stack of images on the homepage o Zooming in or zooming out on an image o Displaying a timer or count-down on a website o Playing audio and video in a web page o Displaying animations - Creating web and mobile apps – o Developers can use various JavaScript frameworks for developing and building web and mobile apps. o Popular JavaScript front-end frameworks include React, React Native, Angular, and Vue. o A few famous examples include Paypal, LinkedIn, Netflix, and Uber. - Building web servers and developing server applications – o Beyond websites and apps, developers can also use JavaScript to build simple web servers and develop the back-end infrastructure using Node.js. - Game development –
o We can use JavaScript to create browser games. Some of the famous games are Pack-Man and Angry Birds.
3. What is JavaScript Interpreter – Explanation – - It is the part of the web browser that understands JavaScript and can execute the steps of a JavaScript program. - Web browsers are built to understand HTML and CSS and convert those languages into a visual display on the screen. - The web browser is usually expecting HTML, so you must specifically tell the browser when JavaScript is coming by using the tag as shown in the following example –
My First JavaScript Program - We can write JavaScript Program inside tag or tag or inside external file having .js extension.5. State different features of JavaScript– Explanation –
Unit I - Basics of JavaScript Programming TEACHING HOURS – 10 TOTAL MARKS – 12 Course Outcome (CO-1) – Create interactive web pages using program flow control Structure.
7. State different types of values in JavaScript– Explanation – Any information present on the webpage between different html tags like , ,
etc., are called values. For example -
welcome to web 2020 Here, the text “ **welcome to web** ” and a number **2020** is a value Types of values in JavaScript are - - Number – any numeric value like 15, 16.35, - 745, 3.14159 etc - String – any text enclosed in double or single quote like “hello everyone” - Boolean – any non-zero value is true and a zero is false - Null – the absence of value is called as Null. - Object – Any object like document, window, form, is also a value. **8. How to declare variable in JavaScript? Explanation –** Variable can be declared in JavaScript using **var** , **let** or **const** keyword. - Variable declared with **var** keyword o Variable declared with var keyword can be re-declared. o It is does not have a block scope. o For example10. Explain different decision making statements in JavaScript - Explanation – In decision making, we test a specific condition and execute one block of statement, if condition is true. If condition is false, we execute another block of statements. Different decision making statements in JavaScript are – o if statement o if … else statement o Nested if…else o else if statement o switch statement o Conditional statement (? : ) - If statement – We use “if statement” to specify a block of code to be executed if condition is true - If - else statement –
We use “if…else statement” to specify a block of code to be executed if condition is true. If condition is false then another block of statements is executed.
Unit I - Basics of JavaScript Programming TEACHING HOURS – 10 TOTAL MARKS – 12 Course Outcome (CO-1) – Create interactive web pages using program flow control Structure.
11. Explain different loop statements in JavaScript - Explanation – In JavaScript, loops are used to execute a block of code repeatedly until a certain condition is met. Following loops are available in JavaScript. While loop: It is used to repeat a given block of statements till a condition is being satisfied. Do - While loop: It is used to repeat a given block of statements till a condition is being satisfied.
For loop: It is used to repeat a given block of statements till a condition is being satisfied. For…in loop: For…in loop is used loop through the properties of an object.
Continue statement
Modifying Object
40 found at 3 40 found at 5
Lecture Notes On Client Side Scripting (CSS-22519) Under MSBTE I-SCHEME Prepared By Prof. S.M. Inwate Unit 2 – Array, Function and String TEACHING HOURS – 10 TOTAL MARKS – 14 Course Outcome (CO-2) – Implement Arrays and Functions in JavaScript.
3. Explain Function with its declaration type. Explanation - In JavaScript, a function is a block of reusable code that performs a specific task or a set of tasks. Functions allow us to encapsulate a piece of code, give it a name, and then invoke (call) that code by referring to its name. This promotes code reusability, modularity, and maintainability in our programs. Function declaration syntax- function function_name(parameters) { Statements; return(value); } For example - function cube(number) { return(numbernumbernumber); } We can call a function by passing arguments to it as shown below- document.write(“Cube of 5 is “ + cube(5)); 4. Explain local variables and default parameters in function. Explanation - Local variables: - Variables declared inside a function are local variables. - They only exist within the scope of that function.
Lecture Notes On Client Side Scripting (CSS-22519) Under MSBTE I-SCHEME Prepared By Prof. S.M. Inwate For example – function add(a,b,c=0) { result=a+b+c; document.write(“Addition=”+result); } In this example, variables a, b, c and result are local variables. Default parameters: