forked from panache-chinmay/javascriptDeccan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
166 lines (138 loc) · 3.92 KB
/
Copy pathscript.js
File metadata and controls
166 lines (138 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// // program 1
//alert , document.write , console.log in javascript
alert("Hello from javscript alert");
//document.write("Hello from javscript 's document write");
document.write('<h1> Hello javascripts write </h1>');
alert("Thanks for visiting and keep coming back");
//
//
// // Setting up the error example for console
//
// // alert("Hello );
// // document.writ("Examples for console error")
//
// console.log("Everthing will be acheived with success");
//
//
//
// // program 2
//
// //(Problem statement in javascript )
//
// // coding challenge one
// //Correct the below code and add console.log statement at begnning and end of program
// // says "javascript code started" and "javascript code ended."
//
//
alert("Hello , Welcome Chinmay");
alert(Where is the code situated?);
document.write("Newly introduced code");
document.write("New implemented features");
//
// // Varibles
//
// // Defining the variables and updating its value .
//
// // program 3
// // (program statement)
// // Define a variable, log it with alert command , update the variable value
// // and again log with alert Command
//
//
//
// var score = 100;
// // passing varible to alert method
// //alert("score"); // incorrect because this is passing string to the alert function;
// alert(score);
// // updating the variable value
// score = 200;
// alert(score)
//
// // Program 4
//
//
// // Program Statement 4 :-
// // Writing string in various forms .
//
//
var checking = "String in double quote";
console.log(checking);
checking = 'String in single quote';
console.log(checking);
checking = "single quote one's within double quote";
console.log(checking);
checking = 'double quote one"s within single quote';
console.log(checking);
checking = 'single one\'s with blackslash';
console.log(checking);
checking = "double quote\" with blacklash";
console.log(checking);
console.log(`my new string ${checking}`)
// String is object
// Object has properties and methods
// Basic property ---Length
// // program statement 5
//
// // Captuting visitor input
//
// // using the prompt() Method
//
//
// var varibaleName = prompt("What is your name");
// alert(varibaleName);
// console.log(varibaleName);
//Single line comment
/* multiple */
//
// // Combining strings
//
// //program statement 6
//
// // combining the string using short hand operator
//
// var visitor = prompt('What is your name');
// var message = 'Hello ' + visitor + " Welcome to the tree house.";
// message += "We are glad that you come by to visit, ";
// message += visitor;
// message += ".Please come again , when you want to learn more.";
// document.write(message);
//
//
// program statement 7:-
// Use various methods of Strings in javascript
//
// var passpharse = 'Open seasame';
// console.log(passpharse.length);
// console.log(passpharse.toLowerCase());
// console.log(passpharse);
// console.log(passpharse.toUpperCase());
// console.log(passpharse);
// Program statement 8
//
// shout app
//
// var stringtoShout = prompt("What should I shout?");
// var shout = stringtoShout.toUpperCase();
// shout += "!!!";
// alert(shout);
//
// // Program statement 9
//
// // The variable Challenge
// // The story maker program.
// The sentence for a program
// The instructions for the story making program !
// Create the variable and capture the input
//Create a separate variable for each piece of input
//Add the alert to tell the visitor that they're finished
// Combine the input with other strings to create a message
// Print the story to the browser window
// "<h2> There once was a [adjective] programmer who wanted to use javascript to [verb] the [noun].</h2>"
// var adjective = prompt("Please enter the adjective");
// var noun = prompt("Please enter the noun");
// var verb = prompt("please enter the verb");
//
// var sentence = "<h2> There was a "+adjective +" programmer";
// sentence += " who wanted to use javascript to "+verb+ " the ";
// sentence += noun;
// document.write(sentence);