JavaScript: Is there a utils library? [closed] - javascript

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm wondering if such a library exists, where the library contains only a collection of common utility functions such as trim, indexOf (for arrays), map, each, typeOf and so on...
I'm aware that jQuery provides some of the functions I listed above, but I'm looking for something that is designed purely for this (I really don't need jQuery on the server-side running node.js for instance, nor do I want to depend on it if I'm writing a non-jQuery-related JavaScript library). I've recently begun collecting an assortment of these functions for future copy/pasting, but my guess is that there are many others that I won't even know to look for, or think of using, unless someone presents them to me.

I'm fond of underscore.js; it doesn't provide string utilities such as trim; it's focused on object-oriented and functional utilities, including all of the other things you mention. Another nice thing about it is that it doesn't reference the DOM at all, so it's useful for javascript programming that isn't web-based or DOM related.

The functions you mention are all standard in ECMAScript 5. And this library implements them in such a way that you can use them in older browsers/JavaScript versions as well, in a way that will be compatible when your environment catches up with the standard:
https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js

Boiler.js is an up and coming utility library that offers many useful JavaScript utilities and is a direct competitor with Underscore.js.

jQuery provides all of those and many more, you would be better off just using it.
jQuery can sit side-by-side with other frameworks, so can be independent if another framework is present.
See: jQuery Utilities Documentation

Javascript itself has many of these functions built into the basic types. Before building your own, perhaps a copy of JavaScript: The Definitive Guide, focusing on the API reference in the back, would do you some solid good.
After that investigate frameworks, or at least being looking into how you can create your own framework for your functions (as opposed to copying and pasting). Here the module pattern would be helpful to you.

Related

JavaScript Language Reference Manual [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a complete and a most updated and downloadable JavaScript Language Reference Manual!?
The closest thing to an official documentation is the ECMA specification. Implementors of JavaScript follow this specification.
However, the most widely used and penetrable (reading the spec for quick reference can be daunting) documentation is JavaScript at Mozilla Documentation Network. It has a lot of information that is handy for using JavaScript in the browser too.
JavaScript is not one thing, with a single possible manual. There are different things that people put together under the JavaScript name:
The ECMAScript standard
The different implementations of a JavaScript engine used by browsers, which extend the ECMA standard with new APIs
Various APIs defined elsewhere, mostly at W3C, such as DOM, HTML5 APIs, other parts that people put under the HTML5 umbrella
Various serverside engines, like Node.js, which add their own APIs, plus all of the libraries that work with these engines
Tons of libraries and frameworks that are built on top of the base JavaScript support that browsers offer, like React, Angular, jQuery...
The best reference for what is normally considered JavaScript is indeed the Mozilla Developer Network.

Is using Prototype to extend native objects bad? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I read somewhere that using prototype to extend native objects (String, Number, Array, etc.) was a bad idea. Is this true? Why or why not?
I don't think it's bad. If you have a look at Ruby on Rails, very many native objects are extended with custom functionality and it's a very good framework.
What would be bad is if you change existing methods on native objects. this could cause unforseen consequences.
There's a great discussion about this in this video from JSConf 2011 by Andrew Dupont. http://blip.tv/jsconf/jsconf2011-andrew-dupont-everything-is-permitted-extending-built-ins-5211542
Basically the points are:
Don't extend Object.prototype
Some people might like to extend things, some people don't
You need to know what you're doing
Don't use two libraries that extend things, because it can be bad
Extending prototypes to add standard functionality is almost always ok.
I would stay clear of extending/modifying behavior of native objects.
It at least makes sense when developing in a team environment.
Simply because, months later, another developer writing another independent piece of code isn't immediately going to recognize the changed behavior unless documented somewhere and made aware of it prior to starting his task.
Instead, I suggest encapsulating/"namespace"-ing all such functionality such that somebody may chose to or not to use the modified functions.
Also, native objects and their methods are thoroughly tested for wide-ranging cases. So you you'd have to be completely sure of what you're doing before modifying native functionality.

Is jquery a dynamic redefinition of javascript? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Learn JavaScript before learning JQuery?
I have read that thread and I still don't find any points convincing me that Javascript is a must-learn-before-jquery thing.
I think jquery is far more than just a javascript library, I would like to call it a redefinition of the dynamic language, the new javascript instead. The library writers clearly made the greatest hit here to change old JavaScript's face almost completely.
Javascript and Jquery are co-existing because Jquery is the javascript library and the fact that people support learning JS first before jquery is likely because they've been client side coders long before the jquery was out, WHICH CURRENTLY EASES THEIR INVESTIGATIONS INTO THE LANGUAGE FAR BETTER, psychologically, they certainly then say "Oh yes, procedural methodologies work greater".
For points concerning writing a function call via mouse/keyboard events, I still agree that javascript structures are preserved and need learning. But does this really make a big difference whether or not learning jquery first should be more beneficial at all ?
Ex:
function something()
{
//jquery code
}
////
<input type="..." onclick="something();"/>
Advice and corrections are required. Thank you so very much.
There are many reasons why its important to learn the native JavaScript, in addition to the jQuery Library:
jQuery is written in JavaScript, so if you ever run into a jQuery bug, or need to patch it, you will need to know the JavaScript
if you ever want to use jQuery efficiently, in many cases it's helpful to read the underlying JavaScript
it isn't guaranteed that jQuery will always be the best Library (something like Scriptaculous may one day surpass it), thus you shouldn't be library-dependent
in many cases you still need to run JavaScript inside of a jQuery function
jQuery may make many things simpler (accessing DOM elements), but in many cases it isn't required

jQuery is JS library. what the term library means? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i don't understand the meaning of the word library -
regarding to jQuery: will it be right to say that "library" is a huge file with many plug ins that are ready to use?
jQuery is a fast and concise JavaScript Library that simplifies HTML
document traversing, event handling, animating, and Ajax interactions
for rapid web development. jQuery is designed to change the way that
you write JavaScript.
All this means is that jQuery itself does not do anything. A library is "a collection of resources used to develop software". jQuery allows you to write cross-browser JavaScript a heck of a lot easier than it would be without it.
A library is something that extends a base langage. So in this definition jQuery is a library
A small(not huge!!!) file (32K only)... With many many functions and features.
Libraries contain code and data that provide services to independent programs. This encourages the sharing and changing of code and data in a modular fashion, and eases the distribution of the code and data.
Wikipedia

What is the difference between jQuery, Prototype, Extjs, mootools, Scriptaculous, Spry, YUI, DOJO framework? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I keep hearing about many JavaScript frameworks i.e.
jQuery
YUI
DOJO
ExtJs
Prototype
Mootools
Scriptaculous
Spry
and a few more.
Can anyone please tell me what specific purpose, do these framework serve?
I am a user of jQuery only.
This is a short description, based on my experience and knowledge (and IMO):
jQuery -> is the most popular javascript library available (great support available on the net and a lot of plugin written for it), it's simple for all (included designers). It's the best choice for dom manipulation and to write code quickly (ideal for front-end)
DOJO -> advanced js library which offers mechanism for loading js "modules" as necessary
ExtJs -> one of the most advanced and powerful js library. It's build with OOP in mind, it offers an huge number of UI components. It's not intended for designers, it's pretty heavy (size of sources). It's the ideal choice for advanced backoffice UI
Prototype -> the evil! Simply avoid this library, it extends default js objects by causing a lot of troubles
YUI -> similar to ExtJS (ExtJs was born as an extension of YUI, so if you have to choose one of the two go for ext :P)
Mootools -> I don't know :P
Scriptaculous -> as far I know, the best for js animations (it was one of the firs library for this task)
Spry -> it introduces some new "concepts" such dataSet. Few people use it :(
These all are javascript libraries, more or less they share the common purpose albeit with different syntax:
Cross-browser issues handling
Animation
Custom dialogs and widgets
Ability to write lesser code
Specific selector engine
Creation/Modification of DOM
Event Handling
Utility Functions
AJAX
Following article is also interesting to read:
Compare JavaScript frameworks
Given they are all JS frameworks they serve almost the same purpose as jQuery serves, by they differ in things such as ease of use, feature richness, UI components, shielding from browser specific functionality, performance, and many others.

Categories