Skip to content

Instantly share code, notes, and snippets.

1)
SELECT * FROM topics
UNION
SELECT * FROM tasks where month="October" ;
2)
SELECT * FROM company_drives
WHERE Date BETWEEN 15 oct-2020 AND 31-oct-2020;
3)SELECT * FROM topics
UNION
SELECT * FROM tasks where placement_status="appeared" ;
1)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document Guvi</title>
</head>
<body>
<div>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
<div>
1)Get all the countries from Asia continent /region using Filter function
var request=new XMLHttpRequest();
request.open('GET','https://restcountries.eu/rest/v2/all','true');
request.send();
request.onload=function (){
var countryData=JSON.parse(this.response);
const asia=countryData.filter((a)=>{
if(a.region==='Asia'){
return a.name;
}
2)
Subtask 1 : The correct way to write this is to write separately the fix.html file and script.js
fix.html
<!DOCTYPE html>
<html>
<body>
<script src=”script.js”></script>
</body>
</html>
and inside script.js invoke alert
@mudra33
mudra33 / gist:3ddc22d805c6eda615280bfd94822552
Created October 3, 2021 09:16
Anonymous and IIFE Questions based on DSA
1)Print odd numbers in an array
anonymous : function(array){
for(var i = 0 ; i< array.length ; i++){
if(array[i]%2!=0){
console.log(array[i])
}
}
}
IIFE : (function(array){
for(var i = 0 ; i< array.length ; i++){
@mudra33
mudra33 / gist:852699fa009e5f9f3e75251aeaaddfb9
Created September 30, 2021 06:27
What is XMLHTTPRequest? & scope
1)How to compare two JSON have the same properties without order?
var obj1 = {"name":"Sam","class":"MCA"};
var obj2 = {"class":"MCA","name":"Sam"};
var flag=true;
if(Object.keys(obj1).length==Object.keys(obj2).length){
for(key in obj1) {
if(obj1[key] == obj2[key]) {
1) For the given JSON iterate over all for loops (for, for in, for of, forEach)
Ans var jsonObject = {
name: 'Mudra Suthar',
Age: '22'
};
for (var prop in jsonObject) {
console.log("Key:" + prop);
console.log("Value:" + jsonObject[prop]);
}
@mudra33
mudra33 / gist:60cc502bef55faa2d680e6e9120d19b6
Created September 18, 2021 09:41
Blog on Difference Between HTTP/1.1 and HTTP/2 and Blog on Objects In Javascript
Link to Blog of Difference Between HTTP/1.1 and HTTP/2 : https://medium.com/@mudra.s/difference-between-http-1-1-and-http-2-a6fab4a1a38
Link to Blog on Objects in Javascript : https://medium.com/@mudra.s/objects-in-javascript-60493113ac80