How was this .js archive encrypted? [closed] - javascript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
How was this code encrypted? A former webmaster left me code encrypted this way. I do not know how to solve.
Code:
function setCookie(a, b, c) {
var d = new Date();
d[_0x6fff[1]](d[_0x6fff[0]]() + 24 * c * 60 * 60 * 1e3);
var e = _0x6fff[2] + d[_0x6fff[3]]();
document[_0x6fff[4]] = a + _0x6fff[5] + b + _0x6fff[6] + e;
}
function getCookie(a) {
var b = a + _0x6fff[5];
var c = document[_0x6fff[4]][_0x6fff[8]](_0x6fff[7]);
for (var d = 0; d < c[_0x6fff[9]]; d++) {
var e = c[d];
while (_0x6fff[11] == e[_0x6fff[12]](0)) e = e[_0x6fff[10]](1);
if (e[_0x6fff[13]](b) != -1) return e[_0x6fff[10]](b[_0x6fff[9]], e[_0x6fff[9]]);
}
return _0x6fff[14];
}

Looks like it's a combination of minification and Hex-encoded Chinese characters:
Minification is a way of reducing the size of a javascript file by replacing long variable names with single letters (a, b, c in your example above)
_0x6fff is the HEX representation of a HAN character: cross on stepping-stones
Once code has been minified, you can't really undo it. See here

Related

Something is wrong with my if and else statement [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Here is my code:
var points = 10
if(points == 10) {
points + 200;
}
else if (points === 100) {
points + 10;
}
console.log(points)
What happens is that it logs 10, when what i would like to happen is that it logs 210. Any idea on what i have done wrong? I got some feedback on it on an earlier question, but it still does not seem to work.
When we use assignment operator we have to use like this:
points = points + 200
so in your code at line "points + 200" or "points + 10" have not changed the value of variable points at all. So, variable points is the same as the first line (var points = 10)
You might modify your program like this:
var points = 10
if(points == 10) {
//points = points +200
points + 200;
}
else if (points === 100) {
//points = points + 10
points + 10;
}
console.log(points)

double loops stuck in forever loop [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am trying to loop over my $('.fore-col') and iterate the index position of my api call variables each time incrementing upwards. Starting at 7 and going up by 8 until at the postion of 40. When i run this code, it is stuck in a "forever loop" i believe and didn't stop at the index position of 40. highest count before i pulled the plug was just over 20k.
Any help would be much appreciated!
url: forecastURL,
method: "GET"
}).then(function(res) {
console.log(res);
$(".fore-col").each(function() {
for (let i = 7; i < 40; i + 8) {
let date = res.list[i].dt_txt;
let icon =
"https://openweathermap.org/img/wn/" +
res.list[i].weather +
".png";
let temp = res.list[i].main.temp;
let humid = res.list[i].main.humidity;
console.log(date, icon, temp, humid);
}
});
```
enter code here
for (let i = 7; i < 40; i + 8) should be
for (let i = 7; i < 40; i = i + 8)

Calculation of Investment Balance in C# or javascripts [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Formula
Investment Balance (Y) =  P*(1+r)^Y +  C *(((1+r)^(Y+1) –
(1+r))/r)
Where:
Y = number of years invested (investment time frame)
P = principal investment amount (current $ value of initial investment to be made)
r = assumed rate of return p.a. (expressed as a decimal, so 5% return would be 0.05)
C = amount of regular contributions pa
Salary: $100,000
Y: 20 years
P: $50,000
r: 0.05
C: 6521
output: 359069.1263
Hey guys, I have this formula I wanted to implement it in C# or JavaScript. I tried a lot but I didn't get the expected output so cloud anyone please describe or write a sample code that I can understand the implementation. It will be highly appreciated.
I don't know which problems did you have writing this in C#, but the code is very simple:
var y = 20;
var p = 50000;
var r = 0.05;
var c = 6521;
var result = p * Math.Pow(1 + r, y) + c * ((Math.Pow(1 + r, y + 1) - (1 + r))/r);
JavaScript:
var y = 20;
var p = 50000;
var r = 0.05;
var c = 6521;
var result = p * Math.pow(1 + r, y) + c * ((Math.pow(1 + r, y + 1) - (1 + r))/r);
You should only assign your values to variables.

javascript unexpected calculation result [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Codes:
g = function () {
H = 3
return H + H
}
f = function () {
Η = 2
return Η + H
}
// 3 + 3 = 6
alert(g())
// 2 + 2 = 5
alert(f())
Live demo:http://jsfiddle.net/qhRJY/light/
While the output is 6 and 5.
It is strange.
Then I try to change the value of the H, the result is still unexpected.
What's the magic here?
In f, the first and second Η are actually the Greek letter Eta, not the Roman H. They look similar, but they're not the same character. It has Unicode code point 0x51377, rather than ASCII code 0x48. So you're adding two different variables.
Would you find the answer unexpected if it were written like this? Because this is equivalent to what you wrote.
g = function () {
H = 3
return H + H
}
f = function () {
Eta = 2
return Eta + H
}
// 3 + 3 = 6
alert(g())
// 2 + 2 = 5
alert(f())
Its a tricky question .Modify the problem with alphabet H.It seems like Roman letters or something special characters.It works fine with 'H' for me.
f = function () {
Η = 3
return Η + H
}
for this code, change to this
f = function () {
I = 3;
return I + I;
}
The 'H' is not cleared from the first function, it's still using the previous value. 2 + 3 = 5

Repeat function takin previous result of this function [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
var x = function (a) { return a + a/4 - 600}
I have a function that does something.
So now my goal is to repeat this function 12 times with an argument used from previous operation;
Let's say initial ammount is 5000;
So
`x(5000) = 5650;
x(5650) =6462.5;
x(6462.) =...;
and this should be repeated 12 times;
So how can this be done in code?
`
Certainly the easiest way would be to use a for loop:
var x = function(a) { return a + a/4 - 600 },
v = 5000;
for (var i = 0; i < 12; i++) {
v = x(v);
}
console.log(v);
I'd not recommend doing something like this, but instead of a loop you could use recursion:
var x = function(42.34, 12);
----
function(double a, int maxSize)
{
a = ((a + a) / (4 - 600));
if(maxSize>0){
maxSize--;
return function(a,maxSize);
}else{
return a;
}
}
(just pseudocode)

Categories

Resources