Javascript Mission 1 - Alternative solution doubt

Learn the basics of how to exploit JavaScript.

Javascript Mission 1 - Alternative solution doubt

Post by Edzk on Sun May 06, 2018 10:10 pm
([msg=95653]see Javascript Mission 1 - Alternative solution doubt[/msg])

Hello World!
I succesfully solved the first mission, it was very easy, but it left me with soume doubts. I found 1 or 2 alternative solutions, pretty much identical & still very very basic.
However they only worked when I saved the paged and edited it on on the notepad, while they did not when editing through Chrome's "inspect".

Could anyone suggest me why is that?

PM me if you're not sure what I'm talking about, it's pretty hard expressing myself clearly while not spoilering

Thx
Last edited by Edzk on Wed May 09, 2018 5:08 am, edited 1 time in total.
Edzk
New User
New User
 
Posts: 2
Joined: Sun May 06, 2018 9:51 pm
Blog: View Blog (0)


Re: Javascript Mission 1 - Alternative solution doubt

Post by supertoto on Tue May 08, 2018 9:56 am
([msg=95663]see Re: Javascript Mission 1 - Alternative solution doubt[/msg])

Hi,
You should be able to write javascript code in the console. Then you can redefine the function of your choice.
supertoto
New User
New User
 
Posts: 3
Joined: Mon Apr 30, 2018 8:49 pm
Blog: View Blog (0)


Re: Javascript Mission 1 - Alternative solution doubt

Post by Edzk on Wed May 09, 2018 5:16 am
([msg=95667]see Re: Javascript Mission 1 - Alternative solution doubt[/msg])

supertoto wrote:Hi,
You should be able to write javascript code in the console. Then you can redefine the function of your choice.


Hello, thanks for your answer, I'm not sure I've understood what you're saying though. I'm 100% newbie.
Could you please articulate it a little more?

What I tried to do was to edit some code while inspecting the page but it did not work. When I did the exact same thing using notepad it worked perfectly fine. The same happened with every JS mission I tried using this technique on.
I really don't get where's the difference

Thanks
Edzk
New User
New User
 
Posts: 2
Joined: Sun May 06, 2018 9:51 pm
Blog: View Blog (0)


Re: Javascript Mission 1 - Alternative solution doubt

Post by supertoto on Wed May 09, 2018 7:35 am
([msg=95668]see Re: Javascript Mission 1 - Alternative solution doubt[/msg])

When you use the element inspector, that doesn't concern javascript, but only the DOM elements (DOM for Document Object Model), that is to say here the HTML code.

But...
When you open the inspector, you can also access a console mode. Here you can write JS code, and it will be interpreted in the current page. So, instead of modifying the script itself in the inspector (that doesn't work), you can use the console to replace the previous c... function.

I think this is not a spoiler if a write :
function c....(...) { ... the new code ... }
because I think it's still more difficult than the normal way.

Don't worry about the message: "undefined", this is the return value.

If you write :
function hello() {return "hello"}
you get undefined

but if after that you write :
hello()
you get "hello"
supertoto
New User
New User
 
Posts: 3
Joined: Mon Apr 30, 2018 8:49 pm
Blog: View Blog (0)



Return to Javascript

Who is online

Users browsing this forum: No registered users and 0 guests