Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

Try this one
***



Modify HTML Element in JS


This is a heading


Then comes a paragraph or a bunch of paragraphs.


So let's add another paragraph.



Hello JS!

Hello JS again!







***
3 years ago
Try this one
***



JS String Operations




JavaScript is a client-side, object-based scripting language that is used to handle and validate client-side data. JavaScript is also used for making the user interface of the web pages more dynamic making it responsive to events like the movement of the mouse, mouse click on a certain HTML element, a btn click, etc, using which we can improve the user experience.













***
3 years ago
Try this one
***
let x = 5;
let y = 2;
// write code here
let z = x + y;
console.log(z);

let a = 200;
let b = 25;
// write code here
let c = a / b;
console.log(c);

let p = 12;
// write code here
p++;
console.log(p);
***
3 years ago
Try this one
***
let player = {
name: "default_name",
weapon: "Pistol",
exp: "Pro",

// defining method
setName: function(name) {
this.name=name;
},
getName: function() {
return this.name;
},
showInfo: function() {
console.log(`${this.name} uses ${this.weapon} and is ${this.exp} level player in STBattleRoyal`);
}
};

player.setName("John Wick");
player.showInfo();
***
3 years ago
Try this one
***
let str1 = 'ambush';
let str2 = 101;
let str3 = false;
let str4=str2+' '+str3+str1;
console.log(typeof str4);
***
3 years ago
thank you for your patience. we are working on it
3 years ago
Try this one
***



JS with HTML





***
3 years ago
try this one
***
function greet(name="NULL")
{
if(name!="NULL")
{
console.log("Hello "+name+"! Thanks for joining us.");
}
else {
console.log("What is your name?");
}
}
greet("studytonight");// call the function
***
3 years ago
Try this one
***
let mobile = {
name: "Apple iPhone 12",
price: 1200,

// defining method
purchase:function(quantity) {
console.log(`Please pay ${(this.price)*quantity} for ${quantity} ${this.name} Mobile phones.`);
}
};

// call the method with argument = 2
mobile.purchase(2);
***
3 years ago
Try this one.
***
// write your code here

var myVar;
console.log(myVar);

var myVar=null;
console.log(myVar);
***
thank you for your patience. we are working on compiler so you might get error have patience..Happy Learning
3 years ago
We are working on it . thank you for your patience
3 years ago
Try this one
***
function multiply(val1,val2,displayResult)
{
// find result of multiplication
let result = val1 * val2;
// display result
displayResult(result);
}

function display(result)
{
console.log("Result: " + result);
}

// call the function
multiply(2,4,display);
***
3 years ago