Ilovepdf Merged
Ilovepdf Merged
1. JavaScript Variables
let keyword.
JAVASCRIPT
1 let message;
= ).
JAVASCRIPT
JAVASCRIPT
1 let message;
2 message = 'Hello Rahul';
1 <!DOCTYPE html>
2 <html>
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=5ada9e21-… 1/5
8/30/23, 6:46 AM Revolutionizing the Job Market | NxtWave
2 <html>
3 <head></head>
4 <body>
5 Your HTML code goes here. W
6 </body>
7 </html>
Note
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 <h1>Web Technologies</
6 <button>Change Heading
7 </body>
8 </html>
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=5ada9e21-… 2/5
8/30/23, 6:46 AM Revolutionizing the Job Market | NxtWave
2.3 Methods
2.3.1 getElementById
The
1 console.log(document.getEl
2.4 Properties
2.4.1 textContent
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=5ada9e21-… 3/5
8/30/23, 6:46 AM Revolutionizing the Job Market | NxtWave
textContent Property.
2.4.2 style
The
For example,
2.5 Events
Events are the actions by which the user or
browser interacts with the HTML Elements.
Actions can be anything like clicking a
button, pressing keyboard keys, scrolling the
page, etc.
The
1 <body>
2 <h1 id="headingElement">
3 <button onclick="manipul
4 </body>
JAVASCRIPT
1 f ti i l t St l (
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=5ada9e21-… 4/5
8/30/23, 6:46 AM Revolutionizing the Job Market | NxtWave
1 function manipulateStyles(
2 document.getElementById(
3 document.getElementById(
4 }
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="stylesheet" href
5 <script src="https://code.j
6 <script src="https://cdn.j
7 <script src="https://stack
8 </head>
9 <body>
10 <div class="dark-background
11 <div>
12 <img
13 src="https://d1tgh8fm
14 class="bulb-image"
15 id="bulbImage"
16 />
17 </div>
Submit Feedback
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=5ada9e21-… 5/5
8/30/23, 6:48 AM Revolutionizing the Job Market | NxtWave
Primitive Types
Reference Types
Boolean
String
Undefined, etc.
1.2 Operators
1.2.1 typeof()
The
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=c5beb3d0-… 1/4
8/30/23, 6:48 AM Revolutionizing the Job Market | NxtWave
JAVASCRIPT
1 let a = 900;
2 let b = 9.2;
3 console.log(typeof(a)); /
4 console.log(typeof(b)); /
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 Your HTML code goes here. W
6 </body>
7 </html>
2. Converting String to a
Number
The
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=c5beb3d0-… 2/4
8/30/23, 6:48 AM Revolutionizing the Job Market | NxtWave
1 let a = '20';
2 console.log(typeof(a)); /
3
4 let b = parseInt(a);
5 console.log(typeof(b)); /
3. Conditional Statements
If...Else Statement:
Syntax:
JAVASCRIPT
1 if (conditionA) {
2 Block1;
3 }
4 else if (conditionB) {
5 Block2;
6 }
7 else {
8 Block3;
9 }
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="stylesheet" href
5 <script src="https://code.j
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=c5beb3d0-… 3/4
8/30/23, 6:48 AM Revolutionizing the Job Market | NxtWave
5 <script src https://code.j
6 <script src="https://cdn.j
7 <script src="https://stack
8 </head>
9 <body>
10 <div class="bg-container te
11 <h1 class="counter-headi
12 <p id="counterValue" cla
13 <div>
14 <button onClick="onDec
15 <button onClick="onRese
16 <button onClick="onInc
17 </div>
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=c5beb3d0-… 4/4
8/30/23, 6:49 AM Revolutionizing the Job Market | NxtWave
1.1 Math.random()
The
1 console.log(Math.random())
1.2 Math.ceil()
The
1 console.log(Math.ceil(95.9
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 Your HTML code goes here. W
6 </body>
7 </html>
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=9298e2a1-… 1/4
8/30/23, 6:49 AM Revolutionizing the Job Market | NxtWave
2. HTML Elements
The HTML
Text
Password
Radio
Date
Checkbox
Note
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=9298e2a1-… 2/4
8/30/23, 6:49 AM Revolutionizing the Job Market | NxtWave
3. DOM Properties
3.1 Value
1 document.getElementById("i
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 <p>Enter your Name</p>
6 <input type="text" id="inp
7 <p>Enter your Password</p>
8 <input type="password" />
9 <div>
10 <button onclick="signIn(
11 </div>
12 <p id="signInText"></p>
13 </body>
14 </html>
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=9298e2a1-… 3/4
8/30/23, 6:49 AM Revolutionizing the Job Market | NxtWave
4. Comparison Operator
Loose equal to (
1 console.log(2 == '2'); //
2 console.log(2 === '2'); /
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=64c6b29b-1c30-4fc9-b45c-2ec92b266c14&s_id=9298e2a1-… 4/4
8/30/23, 6:50 AM Revolutionizing the Job Market | NxtWave
Arrays
Objects
Maps
Sets
2. Array
JAVASCRIPT
The
2.5.1 push()
The
2.5.2 pop()
The
3
4 console.log(myArray); //
5
6 console.log(lastItem); //
3. Functions
1 function showMessage() {
2 console.log("Hello");
3 }
4
5 showMessage();
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=c0caae2e-… 3/7
8/30/23, 6:50 AM Revolutionizing the Job Market | NxtWave
1 document.body.appendChild(
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=c0caae2e-… 4/7
8/30/23, 6:50 AM Revolutionizing the Job Market | NxtWave
1 btnElement.onclick = funct
2 h1Element.textContent =
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=c0caae2e-… 5/7
8/30/23, 6:50 AM Revolutionizing the Job Market | NxtWave
3 h1Element.classList.add(
4
5 console.log(h1Element);
6 };
CSS
1 .heading {
2 color: blue;
3 font-family: "Caveat";
4 font-size: 40px;
5 text-decoration: underli
6 }
1 let removeStylesBtnElement
2 removeStylesBtnElement.tex
3
4 document.getElementById("m
5
6 removeStylesBtnElement.onc
7 h1Element.classList.remo
8 };
10
11 btnElement.onclick = function(
12 h1Element.textContent = "4.0
13 h1Element.classList.add("head
14 };
15
16 let removeStylesBtnElement = do
17 removeStylesBtnElement.textCont
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=c0caae2e-… 7/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
Key Value
firstName Rahul
lastName Attuluri
age 28
city Delhi
1. Creating an Object
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 };
6
7 console.log(person); // O
1.1 Identifiers
Valid Identifiers:
JAVASCRIPT
1 firstName;
2 $firstName;
3 firstName;
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 1/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
3 _firstName;
4 firstName12;
Invalid Identifiers:
JAVASCRIPT
1 12firstName;
2 firstName 12;
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 "1": "value1",
6 "my choice": "value2",
7 };
8
9 console.log(person); // O
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 "1": "value1",
6 "my choice": "value2",
7 };
8
9 console.log(person.firstNa
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 "1": "value1",
6 "my choice": "value2",
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 2/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
7 };
8
9 console.log(person["firstN
Dot Notation:
JAVASCRIPT
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 "1": "value1",
6 "my choice": "value2",
7 };
8
9 console.log(person.gender)
Bracket Notation:
JAVASCRIPT
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 "1": "value1",
6 "my choice": "value2",
7 };
8
9 console.log(person["gender
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 };
6
7 let a = "firstName";
8
9 console.log(person[a]);
10
Expand
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 3/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 };
6
7 let { gender, age } = p
8
9 console.log(gender); /
10
Expand
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 Your HTML code goes here. W
6 </body>
7 </html>
3. Modifying Objects
Dot Notation:
JAVASCRIPT
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 4/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
4 age: 28,
5 };
6
7 person.firstName = "Abhi";
8
9 console.log(person.firstNa
Bracket Notation:
JAVASCRIPT
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 };
6
7 person["firstName"] = "Abh
8
9 console.log(person["firstN
Dot Notation:
JAVASCRIPT
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 };
6
7 person.gender = "Male";
8
9 console.log(person); // O
Bracket Notation:
JAVASCRIPT
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 };
6
7 person["gender"] = "Male";
8
9 console.log(person); // O
4. Property Value
The Value of Object Property can be
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 5/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
Function
Array
Object
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 run: function () {
6 console.log("Start Ru
7 },
8 };
9
10 person.run(); // Start R
Methods:
For example, in
document.createElement(); , the
document is an Object, createElement
is a key and createElement() is a Method.
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 habits: ["Playing Che
6 };
7
8 console.log(person.habi
9
10 console.log(person.habi
Expand
1 let person = {
2 firstName: "Rahul",
3 lastName: "Attuluri",
4 age: 28,
5 habits: ["Playing Che
6 car: {
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 6/7
8/30/23, 6:51 AM Revolutionizing the Job Market | NxtWave
7 name: "Audi",
8 model: "A6",
9 color: "White",
10 },
Expand
1 <!DOCTYPE html>
2 <html>
3 <head></head>
4 <body>
5 Your HTML code goes here. W
6 </body>
7 </html>
https://learning.ccbp.in/course?c_id=5e93210e-f183-433d-a12d-79d81deb01be&t_id=79fb8730-bdad-4ef8-a1ea-7e79d207fd8b&s_id=2a65b1b9-f… 7/7