Skip to content

Instantly share code, notes, and snippets.

View Jagathishrex's full-sized avatar
🎯
Focusing

Jagathishrex

🎯
Focusing
View GitHub Profile
var text = encodeURIComponent("Follow JavaScript Jeep form Amazing JavaScript Tutorial");
var url = "https://medium.com/@jagathishsaravanan/";
var user_id = "jagathish1123";
var hash_tags = "JS,JavaScript,100DaysOfCode,Programming";
var params = "menubar=no,toolbar=no,status=no,width=570,height=570"; // for window
function ShareToTwitter(){
let Shareurl = `https://twitter.com/intent/tweet?url=${url}&text=${text}&via=${user_id}&hashtags=${hash_tags}`;
window.open(Shareurl,"NewWindow" , params);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
function test() {
try {
return 10;
} finally {
console.log("finally");
return 1;
}
}
console.log( test() ); // finally 1
function test() {
try {
return 10;
} finally {
console.log("finally");
return 1;
}
}
let a = test(); //finally
console.log( a ); // 1
function test() {
try {
return 10;
throw "error"; // this is not executed, control goes to finally
} catch {
console.log("catch");
return 1;
} finally {
console.log("finally");
return 1000;
try {
let a = 10;
throw "a is block scoped ";
} catch(e) {
console.log("Reached catch");
console.log(a); // Reference a is no defined
}
try {
var a = 10;
throw "a is function scoped ";
} catch(e) {
console.log("Reached catch");
console.log(a); // 10
}
try {
// code with bug;
} catch {
// catch without exception argument
}
function callback() {
// error code
}
function test() {
try {
setTimeout( callback , 1000);
} catch (e) {
console.log( "not executed" );
}
}
function callback() {
try {
// error code
}catch
console.log("Error caught") ;
}
}
function test() {
setTimeout(callback, 1000);
}