Bài đăng

Đang hiển thị bài đăng từ Tháng 2, 2016

join two array string using concat()

Hình ảnh
     concat method is used to join two or more arrary or strings. This method does not change the existing(old) value, but return the joined value(new value). Syntax string1.concat(string2); or array1.concat(array2); Example 1 var str1="Allinworld"; var str2="99"; alert(str1.concat(str2)); Example 2  var ar1 = ["A","B","C"];  var ar2 = ["D","E","F"]; alert(ar1.concat(ar2)); Example Program:- (Editor) Editor is Loading... Output:- Advertisement

slice() string in javascript

Hình ảnh
          Return the selected value from string, we can select the string value by using index. If the specified index value is outof range then it will return the -1. slice() method for array values Syntax      string.slice(startindex[,endindex]);   endindex is the optional. Example str="Merbin joe" ; alert(str.slice(3));   //return from 3rd character ["bin joe"] alert(str.slice(3,5)); //return 3 to 5th character ["bi"] Example Program:- (Editor) Editor is Loading... Output:- Advertisement

slice() array in javascript

Hình ảnh
     Return the selected value from array, we can select the array value by using index. If the specified index value is out of range then it will return the -1. slice() method for string values Syntax      string.slice(startindex[,endindex]);  endindex is the optional. Example : var fruits = ["Jan", "Feb", "Mar", "Apr", "May"]; alert(fruits.slice(1)); //return 2 to 5th value  (Not removed) alert(fruits.slice(2,4));  //return 3 to 4th value Example Program:- (Editor) Editor is Loading... Output:- Advertisement

Types of calling a function while click in javascript

Hình ảnh
     In javascript we can call a function while clicking html elements in three types, they are define in following example. 1) onclick 2) object.onclick 3) addEventListener 1) onclick:      This is type is define inside the html tag. When you want to call a function in while clicking you can use the onclick attribute inside the html elements. Syntax <element onclick="script or function calling"> Example <script>  function cl_fun() {   alert("Function Called"); } </script>   <input type="button" onclick="cl_fun();" value="Click Here"> 2) object.onclick      In this method we are call a function using html elements id. Syntax var obj=document.getElementById("element_id"); obj.onclick=function(){/*script here*/}; Example <script>  var obj=document.getElementById("btnid");  obj.onclick=function(){alert("Function Called");}; or  var obj=document.getElementById("btnid...

How to convert html to pdf using c#?

Hình ảnh
     In this section we are going to see how to convert the pure html and css code to pdf using itextsharp and itexsharp.xmlworker dll's. Download itextsharp.xmlworker.dll Downlaod itextsharp.dll Note:      You should use the same version of the itextsharp.dll and itextsharp.xmlworker.dl If you not use the same version you will see like the following error.  Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1705: Assembly 'itextsharp.xmlworker, Version=5.5.8.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' uses 'itextsharp, Version=5.5.8.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' which has a higher version than referenced assembly 'itextsharp, Version=5.5.0.0, Culture=neutral, PublicKeyToken=8354ae6d2174dd...

Boolean method in javascript

Hình ảnh
     The Boolean() constructor function takes one parameter to be converted to a boolean value (i.e., true or false). Any valid JavaScript value that is not 0, −0, null, false, NaN, undefined, or an empty string(""), will be converted to true. Below, we create two boolean object values. One true, one false. ""   => empty string returns false value "any val"   => string returns true value 3<4    => returns true 4<3   => returns false null  => returns false Syntax      Boolean(condition); Example      alert(Boolean(3>4)); Example Program:- (Editor) Editor is Loading... Output:- Advertisement Tags: Boolean() method in allinworld99, Boolean() method will return true or false value

if statement

Hình ảnh
     If the condition is true the if statements are executed otherwise the next statement will execute. Syntax      if(condition)      {         Statements;      } Flow chart Example    if(10<50)    {       alert("Executed");    } Example Program:- (Editor) Editor is Loading... Output:- Advertisement Tags: if statement in javascript allinworld99, if statement in java allinworld99, if statement in c, if statement in cpp, if flow chart in allinworld99,

if...else flow chart with easy example

Hình ảnh
      if...else is used to check the condition and if the condition is true the if part statements are executed and if the condition is false the else part statements are executed. Syntax   if(condition)   {      Statements;   }   else   {      Statements;   } Flow Chart: Example: if(10<5) {    alert("5 is big"); } else {    alert("10 is big"); } Example Program:- (Editor) Editor is Loading... Output:- Advertisement Tags: if else in allinworld99, allinworld99 to solve if else condition

flow chart with example for if then else...if

Hình ảnh
     The if...Then...else statement is fundamental to many programming languages. In Intent language, this statement can appear in several different forms.      allinworld99 recommended you to learn logical wise concept. Syntax    if(condition)   {     statements;   }   else if(condition)   {     statements;   }   else  {     statements;   } Flow Chart: Example: if(6<10) {    alert("10 is big"); } else if(10<15) {    alert("15 is big"); } else {    alert("No condition matched"); } Example Program:- (Editor) Editor is Loading... Output:- Advertisement Tags: if else if then else in allinworld99, allinworld99 in if else if then else

details of switch case statement

Hình ảnh
      A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case. Syntax switch(expression) {   case condition_variable-1:           statements;           break;   case condition_variable-2:           statements;           break;   case condition_variable-3:           statements;           break;       --------------       --------------       --------------   case condition_variable-n:           statements;           break; default:            statements; } Example a=3; switch(a) case 1: {       alert("One");       br...

for loop structure and full explain with example

Hình ảnh
Why For Loops? 1) Like all loops, "for loops" execute blocks of code over and over again. 2) The advantage to a for loop is we know exactly how many times the loop will execute before the loop starts. Syntax for(initialization; condition; increment/decrement) {   Statements; } Example: for(i=0;i<=5;i++) {   statements; } Flow chart of for loop:       In the following flowchart is draw similar to the above example, don't forget to see the whole explanation about the flowchart. Step 1:      Start  Initialization, if you want to initialize  any value you can assign here this is optional . Step 2:      Conditions are return true or false value this also optional, some examples are Conditions 3>5        => return False 6<=6     =>  return True 3==3     =>  return True Symbols <           => Less than >     ...

Read object using for of in javascript

Hình ảnh
     for of loop was introduced in ES6 which allows you to easily iterate over elements of an collection.for of iterates over the values of elements of a collection not the keys. A collection can be an array, set, list, custom collection object etc.      Earlier to ES6 we had to use for loop or Array’s foreach loop to walk through elements of an collection. ES6 introduced a new way for iteration.      The following example is help you to read all the value from objects. Syntax     for (variable of array_or_object)     {        Statements;     } Example     for(i of ar_ob)       {         debugger;         alert("Name : "+i.name);         alert("Mark : "+i.mark);       } Examp...