How to get javascript functions native code [duplicate] - javascript

This question already has answers here:
How can I read ‘native code’ JavaScript functions?
(3 answers)
Closed 5 years ago.
Is there any way to see the native code of javascript build-in functions in browser console so I can Know the algorithm efficiency of the function and how it actually works

Ensure you are using an open source browser (or get a job where you get access to the source code of the browser you are using)
Look through that source code of that browser
Native code is program source code that has been compiled to native machine code. The source code isn't on your system unless you get it from some other source. It certainly isn't available to JavaScript.

Related

Javascript stopping people from seeing api and server keys [duplicate]

This question already has answers here:
How do I hide javascript code in a webpage?
(12 answers)
Closed 12 months ago.
Is there a way I can stop people from seeing the Javascript Source code that includes the Server API key and server information?
No, there is not.
You can obfuscate and minify your code, but that doesn't help since your users can look at their browser's Network Inspector instead.

How to inspect javascript method implementations [duplicate]

This question already has answers here:
Where can I find javascript native functions source code? [duplicate]
(3 answers)
How to get native javascript functions source code?
(4 answers)
Closed 2 years ago.
Whenever I try to look at JavaScript method definitions like Math.max() for example, I'll usually end up in a .d.ts file and I don't know where to go from there to view the actual method implementation.
Is there a way to inspect the source inside the JS v8 engine?

Source code for Array.prototype.concat() [duplicate]

This question already has an answer here:
Array.prototype.concat() under the hood
(1 answer)
Closed 5 years ago.
Can I check how internally Java Script APIs are implemented. For example, I want to check how methods in Array.prototype or String.prototype are implemented.
Thanks
Datha
Javascript is implemented by browsers. So the implementation of different Javascript APIs will be browser specific and you will have to look at browser's source code, which might be in any language, not necessarily Javascript. Most of the commercial browsers are not open source so you wont be able to look at their source code. However chromium is open source , so if you want to have a look at their source code you can find it here Chromium git repo

Internationalisation of javascript frontend messages? [duplicate]

This question already has answers here:
How to handle localization in JavaScript files?
(3 answers)
Closed 9 years ago.
I need to internationalise the javascript messages in the frontend, I'm using play framework 2.2.1, for backend messages I followed this: http://www.playframework.com/documentation/2.0.x/ScalaI18N
But I could not find anything for frontend, any ideas? Thanks!
Play has no native support for JS internationalization, anyway you can easily do it yourself using common JS files containing objects with labels + small method for finding proper translation.
Check this answer - you'll find there full implementation for Play 2.x

Can i hide some code in Javascript from the user? [duplicate]

This question already has answers here:
How can I obfuscate (protect) JavaScript? [closed]
(22 answers)
Closed 9 years ago.
I want to have two separate files in JavaScript with the same name , can i do it in javascript ?
I want to expose only part of the code to the user and not all the file
(Do we have any concept on javascript like the c# partial classes ?)
Thanks
Shimon
In the Web Browser, all of the JavaScript code is interpreted locally on the user's machine. So for the Web Browser to be able to interpreted correctly it needs all of the source code. So the answer to your main question is "no".
The closest solution to your problem is doing some sort of obfuscation of the source code. When you do that, it makes the source code very hard for the user to read the source code, but the Web Browser can still interpret it.
To answer the last question, all objects in JavaScript can be extended like partial classes in C#.
Nope - you can't fully hide JavaScript from your end users. The users browser needs to be able to parse the code and as such the user will have access to it as well.
What you can try to is use some form of code obfusication. This will still allow the user's browser to parse the code but will make it very difficult for a user to read and understand what's going on.
That said, it's not impossible for a user to un-obfusicate the code and see the logic behind it - it is just another layer of security but by no means fool proof.

Categories