Giter Site home page Giter Site logo

a-whole-guide-to-javascript-'s Introduction

A-WHOLE-GUIDE-TO-JAVASCRIPT-

This guide contains all Javascript concept made into a small HTML program . //VIGHNESH TIWARI , AIT PUNE , INDIA //GITHUB PROFILE : CR7VIGGY

<script type = "text/javascript"> /*adding comments in javascript*/ document.write("hello java script i m on u right now");

var x = 20; var y = "i m in love with u javascript\n"; var z = "u r so awesome"; var m = "parameterized function"; var n = "of two variables"; document.write(y+z+"i love u"+x+"times"); /non parameterized function in javascript/ function fun() { alert("you are done with alert funtion also .CONGRATS!!"); } fun(); /parameterized funcion in javascript/ function pfun(m,n) { document.write("you are in a "+m+n); } pfun(m,n);

/creating a calculation in javascript/ function cal() { var x = prompt("enter x"); var y = prompt("enter y"); x = parseInt(x); y = parseInt(y); var z = x+y; document.write(z); } /else if using a function/ function ifelse() { var x = prompt("enter a value"); x = parseInt(x); if(x == 0) document.write("oops you have entered zero"); else document.write("correct value"); }

/switch statements/ function switchstat() { var x = prompt("enter 1 : say hi \n enter 2 : say bye"); x = parseInt(x); switch(x) { case 1 : document.write("hi");break; case 2 : document.write("bye");break; } }

/loop statements/ function loop() { var x = prompt("enter x"); x = parseInt(x); var sum = 0; sum = parseInt(sum); for(i = 0 ; i <= x ; i++) { sum = sum + x; } document.write("sum till entered no. is:"+sum); } /creating objects in javascript/ function person() { var car = {type:"Fiat", model:"500", color:"white"}; document.write(car.type+car.model+car.color); } /arrays in javascript/ function arr() { var x = prompt("enter array size"); x = parseInt(x); var arr = []; for(var i = 0; i < x; i++) arr.push(prompt("Enter a number")); alert("full array : "+arr.join(' ,')); } /array sorting in javascript/ function arrsort() { var x = prompt("enter array size"); x = parseInt(x); var arr = []; for(i = 0 ; i < x ; i++) { arr.push(prompt("enter a no.")); } for(i = 0 ; i < x ; i++) { arr.sort(function(a,b){return a-b}) } alert("sorted array :"+arr.join(' ,')); } /math random function/ function random() { document.write(Math.random()); } /displaying dates in javascript/ function dates() { document.write(Date()); } /using boolean function/ function bool() { alert("we ll compare two no.s which is greater\n if first no. is greater than second o/p ll be true else false"); var x = prompt("enter A"); var y = prompt("enter b"); x = parseInt(x); y = parseInt(y); document.write(prompt(Boolean(x>y))); } /ternary operator in javascript/ function ternary() { var x = prompt("enter your age"); x = parseInt(x); var y = (x >= 18) ? alert("you are now an adult") :alert("you are not an adult"); } /search function in javascript/ function search() { var x = prompt("enter a word"); var y = prompt("enter a alphabet to search its position in previous word"); var n = x.search(y); n = parseInt(n); alert(n+1); } /replace a string or alphabet/ function replace() { var x = prompt("enter a word"); var y = prompt("enter another word"); var txt = x.replace(x,y); alert(txt); } </script>

a-whole-guide-to-javascript-'s People

Contributors

halfbloodprince16 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.