Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 28b38b7

Browse files
feat: add Topic1 folder and some questions
1 parent d388ded commit 28b38b7

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

‎Topic1/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
10+
<body class="w-full h-screen bg-zinc-800 flex items-center justify-center">
11+
<h1 class="text-white text-3xl font-semibold font-mono">Learning DSA in JavaScript</h1>
12+
13+
14+
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
15+
<script src="index.js"></script>
16+
</body>
17+
18+
</html>

‎Topic1/index.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// in-case you don't know we can create variables like this also & and this wll only work with var and you can use the var varibles before initializing them NOTE: you have to use let & const
2+
a = 12;
3+
console.log(a);
4+
var a;
5+
6+
7+
// Question: sum of two integers
8+
let num1 = 10;
9+
let num2 = 20;
10+
console.log(num1 + num2);
11+
12+
13+
// Question: Relation between integer and string
14+
let str = '12';
15+
let num = 13;
16+
console.log(typeof (str + num)); // this process is called concatination
17+
18+
19+
// Question: sum and message
20+
let num3 = 10;
21+
let num4 = 20;
22+
console.log(`sum of ${num3} and ${num4} is` + " " + num3 + num4);
23+
console.log(`sum of ${num3} and ${num4} is` + " " + (num3 + num4));
24+
25+
26+
// type coercion
27+
console.log(str + num);
28+
console.log(str - num);
29+
console.log(str * num);
30+
console.log(str / num);
31+
32+
33+
// Answer and type the answer | from moving to one type to another is called type conversion
34+
/*
35+
let age = prompt("Enter your age");
36+
age = Number(age);
37+
console.log(typeof(age), age);
38+
*/
39+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /