't' used outside of binding context
782
783 if (v.includes('-')) {
784 var d = String(v.split(' ')[0]).split('-')
785 var t = String(v.split(' ')[1]).split(':')786 } else {
787 var d = [0, 0, 0]
788 var t = String(v.split(' ')[0]).split(':')
'd' used outside of binding context
781 const FMT = this.setFormats()
782
783 if (v.includes('-')) {
784 var d = String(v.split(' ')[0]).split('-')785 var t = String(v.split(' ')[1]).split(':')
786 } else {
787 var d = [0, 0, 0]
't' used outside of binding context
792 var t = [0, 0, 0]
793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)796
797 if (!nuDateIsValid(o)) { return '' }
798
't' used outside of binding context
792 var t = [0, 0, 0]
793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)796
797 if (!nuDateIsValid(o)) { return '' }
798
't' used outside of binding context
792 var t = [0, 0, 0]
793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)796
797 if (!nuDateIsValid(o)) { return '' }
798
't' used outside of binding context
789 }
790
791 if (t[0] == 'undefined') {
792 var t = [0, 0, 0]793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)
't' used outside of binding context
788 var t = String(v.split(' ')[0]).split(':')
789 }
790
791 if (t[0] == 'undefined') {792 var t = [0, 0, 0]
793 }
794
't' used outside of binding context
785 var t = String(v.split(' ')[1]).split(':')
786 } else {
787 var d = [0, 0, 0]
788 var t = String(v.split(' ')[0]).split(':')789 }
790
791 if (t[0] == 'undefined') {
'd' used outside of binding context
792 var t = [0, 0, 0]
793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)796
797 if (!nuDateIsValid(o)) { return '' }
798
'd' used outside of binding context
792 var t = [0, 0, 0]
793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)796
797 if (!nuDateIsValid(o)) { return '' }
798
'd' used outside of binding context
792 var t = [0, 0, 0]
793 }
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)796
797 if (!nuDateIsValid(o)) { return '' }
798
'd' used outside of binding context
784 var d = String(v.split(' ')[0]).split('-')
785 var t = String(v.split(' ')[1]).split(':')
786 } else {
787 var d = [0, 0, 0]788 var t = String(v.split(' ')[0]).split(':')
789 }
790
'i' used outside of binding context
657 row.shift()
658 row.pop()
659
660 if (o.deleted[i] == 0) {661 for (let ro = 0; ro < row.length; ro++) {
662 if (ro != 0) {
663 row[ro] = Number(row[ro])
'i' used outside of binding context
652 }
653
654 for (var i = 0; i < o.rows.length; i++) {
655 var row = JSON.parse(JSON.stringify(o.rows[i]))656
657 row.shift()
658 row.pop()
'i' used outside of binding context
651 o.columns.push(c)
652 }
653
654 for (var i = 0; i < o.rows.length; i++) {655 var row = JSON.parse(JSON.stringify(o.rows[i]))
656
657 row.shift()
'i' used outside of binding context
651 o.columns.push(c)
652 }
653
654 for (var i = 0; i < o.rows.length; i++) {655 var row = JSON.parse(JSON.stringify(o.rows[i]))
656
657 row.shift()
'i' used outside of binding context
651 o.columns.push(c)
652 }
653
654 for (var i = 0; i < o.rows.length; i++) {655 var row = JSON.parse(JSON.stringify(o.rows[i]))
656
657 row.shift()
'row' used outside of binding context
678 row.push(o.chartData[p][i])
679 }
680
681 o.chartDataPivot.push(row)682 }
683
684 if (nd == 0) { // -- no deleting allowed
'row' used outside of binding context
675 row = []
676
677 for (let p = 0; p < o.chartData.length; p++) {
678 row.push(o.chartData[p][i])679 }
680
681 o.chartDataPivot.push(row)
'row' used outside of binding context
672 o.chartData.splice(0, 0, titles)
673
674 for (var i = 0; i < o.chartData[0].length; i++) {
675 row = []676
677 for (let p = 0; p < o.chartData.length; p++) {
678 row.push(o.chartData[p][i])
'i' used outside of binding context
683
684 if (nd == 0) { // -- no deleting allowed
685 for (var i = 0; i < o.rows.length; i++) {
686 o.deleted[i] = 0687 }
688
689 if (na == 1) {
'i' used outside of binding context
682 }
683
684 if (nd == 0) { // -- no deleting allowed
685 for (var i = 0; i < o.rows.length; i++) {686 o.deleted[i] = 0
687 }
688
'i' used outside of binding context
682 }
683
684 if (nd == 0) { // -- no deleting allowed
685 for (var i = 0; i < o.rows.length; i++) {686 o.deleted[i] = 0
687 }
688
'i' used outside of binding context
682 }
683
684 if (nd == 0) { // -- no deleting allowed
685 for (var i = 0; i < o.rows.length; i++) {686 o.deleted[i] = 0
687 }
688
'i' used outside of binding context
675 row = []
676
677 for (let p = 0; p < o.chartData.length; p++) {
678 row.push(o.chartData[p][i])679 }
680
681 o.chartDataPivot.push(row)
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);
}