So I'm using a script on my Weebly website for that produces a fully-functional scientific calculator. Unfortunately, the script produces the error:
"Ignoring get or set of property that has [LenientThis] because the 'this' object is incorrect."
When I returned to the script to see what was happening I noticed some of the characters had been altered (see below), thus rendering the script unusable. Here is a snippet of what the code should look like:
(function(window) {
'use strict';
var calcSS3 = document.querySelector('.calc-main'),
// display things
display = calcSS3.querySelector('.calc-display span'),
radDeg = calcSS3.querySelector('.calc-rad'),
smallerButton = calcSS3.querySelector('.calc-smaller'),
hold = calcSS3.querySelector('.calc-hold'),
lnButton = calcSS3.querySelector('.calc-ln'),
helpButton = calcSS3.querySelector('.calc-info'),
secondKeySet = [].slice.call(calcSS3.querySelector('.calc-left').children, 12, 20),
hiddenCopy = calcSS3.querySelector('textarea'),
pressedKey,
frozenKey, // active calculation keys
secondActive = false, // 2nd key active?
bracketKey,
brackets = 0, // count of current open brackets
calculator = [], // instances of Calculator
deg = false, // Deg mode or Rad
memory = 0,
resBuffer = '0',
bigger = false, // app size
ln = 0,
buffStr = [],
sav = ['secondActive', 'deg', 'memory', 'buffStr', 'resBuffer'],
keyBoard = {},
secondLayer = [
['sin', 'cos', 'tan', 'ln', 'sinh', 'cosh', 'tanh', 'e<sup>x</sup>'],
[
'sin<sup>-1</sup>', 'cos<sup>-1</sup>', 'tan<sup>-1</sup>', 'log<sub>2</sub>',
'sinh<sup>-1</sup>', 'cosh<sup>-1</sup>', 'tanh<sup>-1</sup>', '2<sup>x</sup>'
]
],
Calculator = function() { // for every '(' a new instance
this.stack = [],
this.num = 0,
this.res = 0,
this.buff = [false, false];
this.curr = true;
this.rank = {
'=': 0,
'+': 1, '-': 1,
'/': 2, '*': 2,
'yx': 3, 'x√y': 3, 'EE': 3
};
};
In the third last line, this is what I get:
'yx': 3, 'xây': 3, 'EE': 3
I get similar results showing up at other places throughout the script as well. What's going on?
You are required to use "\√"
for sqrt character notation to make it work.
For further references:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.