I am trying to solve this code

var string = “2b903102b29299c12d6c1e2ac80169”;
var flag = “”;
for (var i = 0; i < string.length; i++) {
// There is an easier way to find this than calculating by hand!
var ascii = string.charCodeAt(i);
ascii = ascii + i;
flag = flag + String.fromCharCode(ascii);
}
flag = "The flag is: " + flag;

THANKS!!

1 Like

I don’t know this much about JS, but thank you for asking this in the right category

No problem!!

Could you post a description of the problem you are trying to solve?

It appears that the variable, `string`, contains hexadecimal ASCII codes. If so, the characters in `string` need to be parsed, in pairs, to integers, and then those integers need to be converted to characters, in order to compute the flag. Here’s what I have so far, but after you post the problem description, we can revise the solution, if necessary …

``````var string = "2b903102b29299c12d6c1e2ac80169";
var flag = "";
var ascii;
var ch;
for (var i = 0; i < string.length; i+=2) {
// There is an easier way to find this than calculating by hand!
ascii = parseInt(string.substring(i, i + 2), 16);
ch = String.fromCharCode(ascii);
flag = flag + ch;
}
flag = "The flag is: " + flag;
``````

EDIT - This discussion is about the same puzzle as this other discussion, and the puzzle seems to originate at this web site.

plz any one help me I need the answer for the var string = “2b903102b29299c12d6c1e2ac80169”;

var flag = “”;

for (var i = 0; i < string.length; i++) {

// There is an easier way to find this than calculating by hand!

var ascii = string.charCodeAt(i);

ascii = ascii + i;

flag = flag + String.fromCharCode(ascii);

}

flag = "The flag is: " + flag;

This topic applies to a puzzle that is posted on a web site external to Codecademy. It seems to require looking for clues that may be embedded in the original web page where the puzzle is posted. For all we know, some of the clues may be in the source code for the original web page, or could involve clicking an actual link on that page. Maybe it requires some trial and error actions, such as copying and pasting the so-called “flag” into a form. Since some of the original clues that may be hidden cannot be reproduced here, I don’t think this is the best place to try to find the answer. The original page is probably the best venue for solving the problem, and it is here: Not a script kiddie.

2 Likes