Você está na página 1de 6

REPORT ON

Javascript

By

Karthika sri.A
Angular js:

AngularJS (commonly referred to as "Angular.js" or "AngularJS") is a JavaScript-based open-


source front-end web application framework mainly maintained by Google and by a community of
individuals and corporations to address many of the challenges encountered in developing single-
page applications. The JavaScript components complement Apache Cordova, a framework used for
developing cross-platform mobile apps. It aims to simplify both the development and the testing of
such applications by providing a framework for client-side model–view–controller (MVC) and model–
view–viewmodel architectures, along with components commonly used in rich Internet applications.

The AngularJS framework works by first reading the HTML page, which has additional custom tag
attributes embedded into it. Angular interprets those attributes as directives to bind input or output
parts of the page to a model that is represented by standard JavaScript variables. The values of those
JavaScript variables can be manually set within the code, or retrieved from static or
dynamic JSON resources.

Example 1:

<!DOCTYPE html>
<html lang="en-US">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="">
<p>Name : <input type="text" ng-model="name"></p>
<h1>Hello {{name}}</h1>
</div>
</body>
</html>

Example 2:

<div ng-app=" "


<p>Name: <input type="text" ng-model="name"></p>
<p>You wrote: {{ name }}</p>
</div>

Filters used:

 Filter
 Currency
 json
 limitTo
 Lowercase
 Number
 OrderBy
 Upprcase
 Date

Advantage:

 AngularJS provides capability to create Single Page Application in a very clean and maintainable way.
 AngularJS provides data binding capability to HTML thus giving user a rich and responsive
experience.
 AngularJS code is unit testable
Disadvantage:
.
 Getting started is incredibly easy.
 Two-way data binding
 Use of custom directives.

Node js:

Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript


code server-side. Historically, JavaScript was used primarily for client-side scripting, in which scripts
written in JavaScript are embedded in a webpage's HTML and run client-side by a JavaScript engine
in the user's web browser. Node.js lets developers use JavaScript for server-side scripting—running
scripts server-side to produce dynamic web page content before the page is sent to the user's web
browser.

Example 1:

console.log('Hi');
console.log('Hello');

Example 2:

var http = require('http');


var fs = require('fs');
http.createServer(function (req, res) {
fs.readFile('demofile1.html', function(err, data) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write(data);
res.end();
});
}).listen(8080);

Comparision between Angular and node js:

AngularJS framework and Node. Js platform can be quite useful for making powerful client-side and
server-side for developing interactive and feature rich cross-platform web applications in JavaScript
language.

We’ll look at the similarities between these two frameworks and dive deeper into understanding the
JavaScript engine Node Js. What sets apart these three tools and how useful are they for Single
Page Application Development.

Angular and node are Both the open-source tools as node.js is mainly used to build server-side
applications, whereas AngularJS is suited for building single-page client-side web applications both
can be combined to create isomorphic web applications, i.e. applications that are built with the same
language on the back and front-ends, but they are quite different in their architecture and working. If
you go a little further and use MongoDB as your data store, you can build your entire infrastructure
using JavaScript favoured tools
Advantage:

 JavaScript is used by Node.js which is easy to learn the language. So, a basic Java programmer will
find it easy to upgrade to it.
 An open source runtime environment is offered by Node.js so, it supports the caching of individual
modules.
 The asynchronous event-driven IO assists concurrent request handling
 Server side proxy
 NPM(Node Package Manager) play an important role

Disadvantage:

 One of the biggest drawbacks of Node.js is that it isn’t consistent. It’s several development firms feel
that the API keeps enhancing at frequent intervals.
 It doesn’t support relational databases.
 If you want to enhance the scalability of Node.js, having an asynchronous programming approach is
essential. But developers have a split opinion on this as several feel that this approach is quite
complex than the linear blocking I/O programming.

Reactjs:

React is a front-end library developed by Facebook. It is used for handling the view layer for
web and mobile apps. ReactJS allows us to create reusable UI components. It is currently one
of the most popular JavaScript libraries and has a strong foundation and large community
behind it.:

Examples:

class Board extends React.Component {


renderSquare(i) {
return <square value={i}/>;
}

class Square extends React.Component {


render() {
return (
<button className="square">
{
this.props.value}
</button>
);
}
}

Advantage:

 Uses virtual DOM which is a JavaScript object. This will improve apps performance, since
JavaScript virtual DOM is faster than the regular DOM.

 Can be used on client and server side as well as with other frameworks.

 SEO Effective

 Great efficiency
 PolymerJS and Shadow DOM has already created a lot of buzzes which are typically used to
create customizable elements, self-contained element

 Data Streaming

Disadvantage:

 Covers only the view layer of the app, hence you still need to choose other technologies to
get a complete tooling set for development.

 Uses inline templating and JSX, which might seem awkward to some developers.

Embedded js:

EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No
religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain
JavaScript.

Example 1:

<%if(user){%>

<h2><%=user.name%></h2>

<%}%>

Usage:

let template=ejs.compile(str,options);

template(data);

ejs.render(str,data,options);

ejs.renderFile(filename,data,options,function(err,str)

{
});

Advantages:

 Fast development
 Simple syntax
 Easily understandable
 Client-side support
 Static caching of intermediate JavaScript
 Static caching of templates
 Complies with the Express view system

Disadvantage:

 EJS is not as powerful as it doesn't have blocks by default


 The main reason is the lack of block in EJS even with the help of ejs-locals.