'precurser' used outside of binding context
12 }
13
14 console.log(precurser)
15 return precurser; 16}
17
18convertUrlToVideoId("https://www.youtube.com/shorts/lt-YtEvk6Vs")
'precurser' used outside of binding context
12 }
13
14 console.log(precurser)
15 return precurser; 16}
17
18convertUrlToVideoId("https://www.youtube.com/shorts/lt-YtEvk6Vs")
'precurser' used outside of binding context
12 }
13
14 console.log(precurser)
15 return precurser; 16}
17
18convertUrlToVideoId("https://www.youtube.com/shorts/lt-YtEvk6Vs")
'precurser' used outside of binding context
11 }
12 }
13
14 console.log(precurser) 15 return precurser;
16}
17
'precurser' used outside of binding context
11 }
12 }
13
14 console.log(precurser) 15 return precurser;
16}
17
'precurser' used outside of binding context
11 }
12 }
13
14 console.log(precurser) 15 return precurser;
16}
17
'precurser' used outside of binding context
7 if (ytquery.includes("youtu.be/")) {
8 var precurser = ytquery.replace("youtu.be/", "www.youtube.com/watch?v=")
9 } else {
10 var precurser = ytquery 11 }
12 }
13
'precurser' used outside of binding context
7 if (ytquery.includes("youtu.be/")) {
8 var precurser = ytquery.replace("youtu.be/", "www.youtube.com/watch?v=")
9 } else {
10 var precurser = ytquery 11 }
12 }
13
'precurser' used outside of binding context
5 } else {
6 // Valid url
7 if (ytquery.includes("youtu.be/")) {
8 var precurser = ytquery.replace("youtu.be/", "www.youtube.com/watch?v=") 9 } else {
10 var precurser = ytquery
11 }
'precurser' used outside of binding context
5 } else {
6 // Valid url
7 if (ytquery.includes("youtu.be/")) {
8 var precurser = ytquery.replace("youtu.be/", "www.youtube.com/watch?v=") 9 } else {
10 var precurser = ytquery
11 }
'precurser' used outside of binding context
1function convertUrlToVideoId(ytquery) {
2 if (ytquery.match(/youtube.com\/shorts\//g)) {
3 console.log('match')
4 var precurser = ytquery.replace("?feature=share","").replace(/youtube.com\/shorts\//g, "youtube.com/watch?v=") 5 } else {
6 // Valid url
7 if (ytquery.includes("youtu.be/")) {
'precurser' used outside of binding context
1function convertUrlToVideoId(ytquery) {
2 if (ytquery.match(/youtube.com\/shorts\//g)) {
3 console.log('match')
4 var precurser = ytquery.replace("?feature=share","").replace(/youtube.com\/shorts\//g, "youtube.com/watch?v=") 5 } else {
6 // Valid url
7 if (ytquery.includes("youtu.be/")) {
'pointy' used outside of binding context
741 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy);
742 ctxSubYLineLegend.lineTo(
743 paddingLeft + 15, pointy,
744 pointy); 745 ctxSubYLineLegend.stroke();
746 }
747 }
'pointy' used outside of binding context
741 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy);
742 ctxSubYLineLegend.lineTo(
743 paddingLeft + 15, pointy,
744 pointy); 745 ctxSubYLineLegend.stroke();
746 }
747 }
'pointy' used outside of binding context
740 if (drawTickYLine) {
741 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy);
742 ctxSubYLineLegend.lineTo(
743 paddingLeft + 15, pointy, 744 pointy);
745 ctxSubYLineLegend.stroke();
746 }
'pointy' used outside of binding context
740 if (drawTickYLine) {
741 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy);
742 ctxSubYLineLegend.lineTo(
743 paddingLeft + 15, pointy, 744 pointy);
745 ctxSubYLineLegend.stroke();
746 }
'pointy' used outside of binding context
738 );
739 } else {
740 if (drawTickYLine) {
741 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy); 742 ctxSubYLineLegend.lineTo(
743 paddingLeft + 15, pointy,
744 pointy);
'pointy' used outside of binding context
738 );
739 } else {
740 if (drawTickYLine) {
741 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy); 742 ctxSubYLineLegend.lineTo(
743 paddingLeft + 15, pointy,
744 pointy);
'pointy' used outside of binding context
734 ctxLegendYLabel.fillText(
735 `${nameOfNumberSmall}`,
736 30,
737 pointy 738 );
739 } else {
740 if (drawTickYLine) {
'pointy' used outside of binding context
734 ctxLegendYLabel.fillText(
735 `${nameOfNumberSmall}`,
736 30,
737 pointy 738 );
739 } else {
740 if (drawTickYLine) {
'pointy' used outside of binding context
709 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy);
710 ctxSubYLineLegend.lineTo(
711 canvas.width - paddingRight,
712 pointy); 713 ctxSubYLineLegend.stroke();
714
715 var nameOfNumberSmall: any = countsmally;
'pointy' used outside of binding context
709 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy);
710 ctxSubYLineLegend.lineTo(
711 canvas.width - paddingRight,
712 pointy); 713 ctxSubYLineLegend.stroke();
714
715 var nameOfNumberSmall: any = countsmally;
'pointy' used outside of binding context
706
707 if (true) {
708 if (drawLongLine) {
709 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy); 710 ctxSubYLineLegend.lineTo(
711 canvas.width - paddingRight,
712 pointy);
'pointy' used outside of binding context
706
707 if (true) {
708 if (drawLongLine) {
709 ctxSubYLineLegend.moveTo(paddingLeft - 50, pointy); 710 ctxSubYLineLegend.lineTo(
711 canvas.width - paddingRight,
712 pointy);
'percylegend' used outside of binding context
701 viewRange;
702 var pointy =
703 canvasHeightRange -
704 canvasHeightRange * percylegend + 705 paddingTop;
706
707 if (true) {
Description
Variables should be used inside of their binding context.
This helps avoid difficult bugs with variable hoisting.
It is a bad practice to use var
declarations because variables declared using var
can be accessed in a function-wide scope.
They can even be accessed before declaration.
In such cases, their value would be undefined
because only declarations and not initializations are hoisted.
Bad Practice
function doIf() {
if (cond()) {
var build = true;
}
console.log(build);
}
function doIfElse() {
if (cond()) {
var build = true;
} else {
var build = false;
}
console.log(build)
}
Recommended
function doIf() {
let build;
if (cond()) {
build = true;
}
console.log(build);
}