Classify keyword in JavaScript [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Classify ("cs.views/SelectorView", "BaseView",{
templateId: '';
function abc(){
}
});
TemplateId is the filname of the template we have created for the webpage. But can someone tell me what Classify does in JavaScript. I have never heard of it.
Thanks.

Classify isn't part of native javascript, it's a third-parties library.
See definition of what Classify fetched from official website below:
Classify.js is a library that allows for cross browser and cross platform Object Oriented Javascript class definitions using classical inheritance patterns and namespaces behind the prototype syntax of javascript in an easy to use interface function.

Related

Pretty Basic question but why do you need brackets after defining a function? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
function exampleFunction() {}
Why do you need the () after defining exampleFunction??
The brackets at the end of a function can be used to define parameters when calling it.
For example:
alertSentence("Hello, this is an example!");
function alertSentence(string) {
alert(string);
}
This would show an alert dialog with the string: "Hello, this is an example!"
Javascript is a language that was defined following the patterns of c. Wikipedia says it's part of the simula programming language family link. Languages in this family define function parameters using parentheses. Other language families have other ways (see python for an example). Ultimately it's a bit of arbitrary syntax that allows programmers to explicitly define what they want the computer to do and a way for the computer to understand them.

Javascript: Renaming built in functions [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
In Javascript, is it acceptable to rename built in functions. For example, in my code, I use document.querySelector() tons of times. This is extremely long and tedious to type every single time (even with autocomplete from the IDE's side). Therefore, I decided to create a new function with a shorter name like the following:
let qs = selector => document.querySelector(selector);
Is this an acceptable practice in the JS community? Is this considered bad code? If so, why? Additionally, if doing this is alright, what are some drawbacks?
Thanks.
No.
Someone is going to come behind you to edit your code.
They will then have to track down your renaming function to actually see what it does.
Create an snippet in your IDE if it’s that much of an issue for you.

React with JavaScript or TypeScript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
React with JavaScript or TypeScript?
which is best if typescript is please explain why it is.
This will depend on the size and type of the project. If a small project is developed by, for example, only one developer is sufficient for JS, if one is a large enterprise solution, then it is a better typecript.
The TypeScrip main features:
optional static typing (the key here is optional)
type Inference, which gives some of the benefits of types
access to ES6 and ES7 features
the ability to compile down to a version of JavaScript that runs on all browsers

Running JavaScript on Java with native functions? [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
I am building a program in Java and I want to make users able to create plugins in JavaScript. I need a way to make native functions in a "standard lib" so people can use the methods inside the program.
Also I want to make an event system, so this means calling functions inside the JavaScript plugin. How could I achieve this?
To run java-script in java you may use Rhino library in java 1.7
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino
example:
https://github.com/mozilla/rhino/blob/master/examples/Control.java
or Nashorn in java 1.8
http://www.oracle.com/technetwork/articles/java/jf14-nashorn-2126515.html
example:
http://www.infoworld.com/article/2607426/application-development/nashorn--javascript-made-great-in-java-8.html?page=2

What are these javascript methods [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Looking through some open source javascript library and I've come across some single character methods a few times:
myVar.c('foo').t('bar');
myVar refers to an XML DOM element. So what are c() and t()? I don't see any reference to such methods in the API: http://www.w3schools.com/dom/dom_element.asp
There is one remote possibility. When javascript is minified single letters are used to reduce function names. Your example above may be a minified version [file].min.js and therefore function names are obfuscated.

Categories