Declaring Variable and Re-declaring Variables in JavaScript

Declaring Variable

Declaring Variable Rule

  • Variable can contain a combination of letters, digits, underscores ( _ ), and
  • dollar signs ( $ ).
  • Must begin with a letter A-Z or a-z or underscore or dollar sign
  • A variable name cannot start with a number
  • Must not contain any space characters
  • JavaScript is case-sensitive
  • Can‟t use reserved keywords

Declaring Variable

A variable declared without a value will have the value undefined

Tagged : / /

Javascript Tags

<script type="text/javascript">
	document.write("Hello DevOpSchool");  
<script src="devops.js" type="text/javascript"></script>

<script> Opening Script Tag.

src It’s an attribute of the script.

name.js – This is our script file, which we created. The code of javascript is written inside devops.js.
In which DevOps is the file name, .js is the extension. Javascript has an extension of .js

Type – This is also an attribute of the script tag, it tells the browser that it is javascript. Now it is not necessary to write it, you can leave it if you want.

Text/javascript – It defines what type these documents are.

document.write(“Hello World”); – This is a function which is displaying the data.

</script> – Closing Script tag.

How to link more than one External?

You can link more than one JavaScript file to a single document. Just need to write different script tags for that.

<script src="devops1.js" type="text/javascript"></script>
<script src="devops2.js" type="text/javascript"></script>
<script src="devops2.js" type="text/javascript"></script>
<script src="devops3.js" type="text/javascript"></script>

How to use inline and External together in javascript?

No, both cannot be written together. But both inline and external can be written separately.

        <h1>I am Heading</h1>
        <p>I am Paragharph</p>
        <script type="text/javascript">
			document.write("Hello Vijay");  
        <script src="devops.js" type="text/javascript"></script>

Write funtion

This function is used to write arbitrary HTML and content into the page. If we use this function after an HTML document is fully loaded, will delete all existing HTML. It is used only for testing purposes.

Ex:-    document.write("Hello world");
	    document.write("hello world . <br>");
	    document.write("hello world . <br>" + variable +"<br>");

Alert function in JavaScript

The data that will be displayed in it will be in the dialog box. You forcefully want to see this thing, then only this work will be done. In that case, you use a window. alert

Ex:- window.alert("Hello World");
	 window.alert("hello world"+ variable);
	<head><title>Hello JS</title>
`		<h1>I am heading</h1>
		<p>I am Paraghraph</p>
		<script src="name.js" type="text/javascript">


An identifier is a name having a few letters, numbers, and special characters _(underscore). It is used to identify a variable, function, symbolic constants, and so on.

Ex:- X2

Veriable in JavaScript

Variable can be any name, in which a combination of letters, numbers, and special characters can be written _()(underscore) and $(dollar). It is not necessary that there should be only a combination, it can only be a letter.

Ex:- c, fact, b33, total_amount ect.

Rules of Veriable in JavaScript

  • Variable can contain a combination of letters, digits, _()(underscore), and dollar signs($).
  • Must begin with a letter A-Z or a-z or underscore or dollar sign.
  • A variable name cannot start a number.
  • Must not contain any space characters.
  • JavaScript is case-sensitive
  • Can’t use reserved keywords.

Reserved Keyword in javascript

Keyword or Reserved words

Tagged : / / /

How to execute grovvy script remotely on Jenkins server?

A Jenkins Admin can execute groovy scripts remotely by sending an HTTP POST request to /script/ url or /scriptText/.

curl example via bash

curl -d "script=&lt;your_script_here&gt;" https://jenkins/script
# or to get output as a plain text result (no HTML)
curl -d "script=&lt;your_script_here&gt;" https://jenkins/scriptText

curl submitting groovy file via bash

curl --data-urlencode "script=$(&lt; ./somescript.groovy)" https://jenkins/scriptText

curl submitting groovy file providing username and password via bash

curl --user 'username:password' --data-urlencode "script=$(&lt; ./somescript.groovy)" https://jenkins/scriptText

Jenkins CLI offers the possibility to execute groovy scripts remotely using groovy command or execute groovy interactivelly via groovysh.

java -jar jenkins-cli.jar -noCertificateCheck -s groovy disableEnableJobsMatchingPattern.groovy jobPattern=build_git_auto disableOrEnable=disable --username 12345 --password banana




Tagged : / / /

Expect script for Windows created the topic: Expect script for Windows

I’m executing one expect script from windows to do automatic FTP to Unix server.

Error msg:-
D:\expect>tclsh85 telnet.exp
Connecting to to upload the latest build.
invalid command name “spawn”
while executing
“spawn ftp $hostname”
(file “telnet.exp” line 17)

do anyone have any idea about this error/expect script for windows?


Tagged :

Ant script with EMMA code-coverage

scmuser created the topic: Ant script with EMMA code-coverage

Ant script with EMMA code-coverage so it can find runtime coverage data?

<taskdef resource="">
        <pathelement location="lib/emma.jar" />
        <pathelement location="lib/emma_ant.jar" />
<target name="compile">
    <mkdir dir="build"/> <!-- vytvori adresar build -->
    <mkdir dir="build/classes"/>
    <mkdir dir="build/test"/>
    <javac destdir="build/classes" srcdir="src" debug="true" /> <!-- prelozi zdrojove kody -->
    <javac destdir="build/test" srcdir="test"> <!-- prelozi testy -->
        <classpath> <!-- pro prelozeni testu je potreba junit a prelozena aplikace -->
            <pathelement location="lib/junit-4.5.jar" />
            <pathelement location="build/classes" />
<target name="build" depends="compile">
    <jar destfile="tetris.jar" basedir="build/classes"> <!-- zabali aplikaci do jaru -->
            <attribute name="Main-Class" value="tetris.Main"/>
            <attribute name="Class-Path" value="lib/mysql-connector-java-5.1.6-bin.jar lib/derbyclient.jar"/>
<target name="jar" depends="build"></target>
<target name="run" depends="compile">
    <java classname="tetris.Main" classpath="build/classes">  <!-- spusti aplikaci -->
            <pathelement location="lib/mysql-connector-java-5.1.6-bin.jar" />
            <pathelement location="lib/derbyclient.jar" />
<target name="instrument" depends="compile">
    <mkdir dir="build/instrumented"/>
    <emma verbosity="verbose"> <!-- vytvori tridy upravene pro sledovani coverage -->
        <instr instrpath="build/classes"
                merge="true" />
<target name="test" depends="instrument">
    <mkdir dir="reports" />
    <mkdir dir="reports/junit" />
    <junit printsummary="yes" haltonfailure="no" fork="true"> <!-- pusti JUnit testy -->
            <pathelement location="build/test" />
            <pathelement location="build/classes" />
            <pathelement location="build/instrumented" />
            <pathelement location="lib/junit-4.5.jar" />
            <pathelement location="lib/emma.jar" />
            <pathelement location="lib/emma_ant.jar" />
        <formatter usefile="false" type="brief" />
        <formatter type="plain"/>
        <batchtest fork="yes" todir="reports/junit"> <!-- reporty budou v adresari reports/junit -->
            <fileset dir="test">
                <include name="**/"/>
        <jvmarg value="-Demma.coverage.out.file=build/coverage.emma"/>
        <jvmarg value="-Demma.coverage.out.merge=true" />
    <emma enabled="true" verbosity="verbose"> <!-- vygeneruje report emmy -->
        <report sourcepath="src">
            <fileset dir="build" includes="*.emma" />
            <html outfile="reports/coverage.html" />
<target name="clean">
    <delete dir="build"/> <!-- smaze adresar build -->
    <delete dir="reports"/>
    <delete file="tetris.jar"/>

processing input file […NetBeansProjects/Tetris3/build/metadata.emma] …
loaded 25 metadata entries
1 file(s) read and merged in 5 ms
nothing to do: no runtime coverage data found in any of the data files

Tagged :

Script for time stamp update.

scmuser created the topic: Script for time stamp update.

write a batch Script for time stamp update?

sgadmin replied the topic: Re:Script for time stamp update.

tfile=`cat data.txt |wc -l`

for (( i = 2 ; i <= tfile ; i++ ))

mfile=`cat $data |head -$i|tail -1|tr -s ” ” ” ” |cut -f8 -d” “`
mdate=`grep -i $mfile $data|tr -s ” ” ” “|cut -f6,7 -d” “`
myy=`echo $mdate |cut -b 1-4`
mon=`echo $mdate |cut -b 6-7`
mdd=`echo $mdate |cut -b 9-10`
mhh=`echo $mdate |cut -b 12-13`
mmin=`echo $mdate |cut -b 15-16`
mresult=`echo $myy$mon$mdd$mhh$mmin`
touch -t $mresult $mfile


Tagged :

Function in vb script

rajani created the topic: function in vb script

Develop a function that accepts a string of names separated by comma add those names in an array and display the names added in the array.

rajeshkumar replied the topic: function in vb script

Welcome to board….

try following snippet…

Sub Funstr("str1", "str2")

End Sub

I would recommend you going through this url as well to learn more about it……

Rajesh Kumar
Twitt me @

rajani replied the topic: function in vb script

it won’t work
i have write
“Develop a function that accepts a string of names separated by comma (example given below), add those names in an array and display the names added in the array”

Example: rajani; Disha; Dhara; Hunny ;moon
without using split function
can i use mid function

rajani replied the topic: function in vb script

i am able to display name but with comma
Dim fruits()
ReDim fruits(100)
‘we do not know how many fruit names we are going to enter and so, we have declared the array size as 100
For i=0 to 100
fruits(i)=inputbox(“Enter the name of a fruit separated by comma”)
ans = MsgBox(“Do you want to continue”, vbYesNo, “Confirm Continuation…”)
If ans=vbNo Then
Exit For
End If
ReDim Preserve fruits(nofruits)
‘Redim keyword resets the number of elements that can be accommodated in the array.


For each fruit in fruits
‘Using For Each Next we have displayed all the names of the fruits which was entered and kept in fruits array.
‘For Each Next extracts the fruit names stored in the array and msgbox displays the output.


msgbox fruitnames

rajani replied the topic: function in vb script

any suggestion

rajani replied the topic: function in vb script

dim Array, Str1,X
Str1 = “Neha; Swati; Disha; Sonya; Dhara”
Array = split(Str1,”;”)
for each x in Array
message = message & x & vbCRLF
msgbox message

Tagged :

How to read a .properties file through script

rajeshkumar created the topic: How to read a .properties file through script

The easy way to do it is to note that a Java properties file has the same format as a basic shell script.

However, there’s a trick to it. If you just run the properties file like so:


The assignments will be made at the sub-level, then discarded when the properties file (script) ends execution.

So to get the properties in a calling script, you need to use the “source” command:


Note that the space after the initial dot is very important!

To reference shell variable assignments, you use the “$” to indicate variable substitution.

So, to put it all together:

# #!/bin/sh
# # Sample shell script to read and act on properties
# # source the properties:
# .
# # Then reference then:
# echo "My name is $name and I'm $age years old."

Rajesh Kumar
Twitt me @

Tagged :

How to perl script to extract data

mnanjala created the topic: how to perl script to extract data

Hi All,

Below are the contents in the test.txt file

id name adress
1 rajesh pune
2 pravin puttur
3 bani banglore

Now can anybody write perl script to extract data based on id ?

Example if id is 1 it should print rajesh from pune and so on


Tagged :