Posts

How to create a responsive accordion with html and css

Image
 How to create a responsive accordion with html and css Accordions are useful when you want to toggle between hiding and showing large amount of content. We will create accordion with very simple and easy way. Here is the code <! DOCTYPE   html > < html > < head > < style > button.accordion  {      background-color : #cb4d4d;      color : #fff;      cursor : pointer;      padding :  18px ;      width :  100% ;      border : none;      text-align : left;      outline : none;      font-size :  15px ;      transition :  0.4s ; } button.accordion.active , button.accordion:hover  {      background-color : #7d1e1e; } button.accordion:after  { /* Unicode character for "plus" sign (+) is '\02795' */        content :  '\02795' ;      font-size :  13px ;      color : #777;      float : right;      margin-left :  5px ; } button.accordion.active:after  { /* Unicode character for "minus" sign (-) is '\2796' */        content :  &qu

Hello World Program in C++

Hello World Program in C++ The "Hello, World!" program is often the first program beginners write when learning a new programming language. In C++, it's a simple yet powerful way to introduce the basic syntax and structure of the language. Let's break down the components of the C++ "Hello, World!" program: #include <iostream> int main() { std::cout << "Hello, World!" << std::endl; return 0; } Explanation: #include <iostream> : This line includes the iostream header file, which contains declarations for the standard input/output stream objects in C++, such as std::cout and std::endl . int main() : This is the main function of the program. All C++ programs must have a main() function, which serves as the entry point of the program. std::cout << "Hello, World!" << std::endl; : This line uses the std::cout object to output the message "Hello, World!" to

Functions and Scope

Functions and Scope Functions are essential building blocks in JavaScript, allowing you to encapsulate reusable blocks of code. Understanding functions and scope is crucial for writing efficient and maintainable code. Let's explore these concepts in detail: Declaring and Invoking Functions: In JavaScript, you can declare functions using the function keyword. Functions can take parameters and return values. Here's an example of declaring and invoking a function: // Function declaration function greet(name) { return "Hello, " + name + "!"; } // Function invocation let message = greet("John"); console.log(message); // Output: Hello, John! Understanding Scope and Closures: Scope determines the visibility and lifetime of variables in JavaScript. JavaScript has function scope, meaning variables defined within a function are only accessible within that function. Closures are an important concept in JavaScript, referring to the abil

JavaScript fundamentals

JavaScript Fundamentals JavaScript fundamentals lay the groundwork for understanding the language's core concepts, including variables and data types, operators and expressions, and control flow structures. Variables and Data Types: In JavaScript, variables are containers for storing data values. Variables can hold various types of data, including numbers, strings, booleans, arrays, objects, and more. Here's an example of declaring and initializing variables: // Variable declaration and initialization let name = "John"; let age = 30; let isStudent = true; let fruits = ["apple", "banana", "orange"]; let person = { firstName: "John", lastName: "Doe" }; Operators and Expressions: Operators in JavaScript allow you to perform operations on variables and values. JavaScript supports various types of operators, including arithmetic, assignment, comparison, logical, and bitwise operators. Expressions are com

Getting Started with JavaScript

Getting Started with JavaScript Before you begin your journey with JavaScript, it's important to understand the fundamentals and set up your development environment. Let's explore these crucial steps in more detail: Understanding the Basics of JavaScript: JavaScript is a powerful scripting language used primarily for web development. It allows you to add interactivity and dynamic behavior to web pages. JavaScript can manipulate HTML elements, handle events like clicks and mouse movements, and interact with web APIs to fetch and send data. To better understand JavaScript, let's look at a simple example: // JavaScript code to display a message console.log("Hello, JavaScript!"); In this example, we use the console.log() function to display the message "Hello, JavaScript!" in the browser's console. This is a basic example of how JavaScript can be used to perform actions. Setting Up Your Development Environment:

Mastering JavaScript: A Comprehensive Guide for Beginners

Mastering JavaScript: A Comprehensive Guide for Beginners Mastering JavaScript: A Comprehensive Guide for Beginners Are you ready to embark on a journey to master JavaScript? Whether you're a seasoned developer looking to enhance your skills or a beginner eager to dive into the world of programming, this comprehensive guide will equip you with everything you need to know to become proficient in JavaScript. Introduction: In today's digital age, JavaScript has become one of the most essential programming languages for web development. From creating interactive websites to building powerful web applications, JavaScript plays a pivotal role in shaping the modern web. In this guide, we'll start from the basics and gradually delve into more advanced topics, providing detailed explanations and practical examples along the way. Table of Contents: Getting Started with JavaScript

Local Storage in Javascript | HTML5 web storage API

 Local Storage Local Storage is used to store websites data locally on a device. Basically LocalStorage is not a database. LocalStorage provide 5MB of space on user computer. It is use for saving passwords, name, email etc. LocalStorage.setItem The localStorage.setItem is use to set data into localStorage. It can be write as : localStorage.setItem(key, data) ; So the localStorage.setItem has two parameters. The first one use for the key and the second ine use for the data to be store in the localstorage. The key should be in the string.  var data = 12; localStorage.setItem("keyName", data) ; localStorage.getItem  The localStorage.getItem is use to get the data from the localStorage.  localStorage.getItem(key); The l ocalStorage.getItem has only one parameter which is the key. The key of localStorage.getItem should be string.  var data = localStorage.getItem("keyName") ;

Array sorting in c/cpp | Best sorting Algorithm

 Array sorting in Javascript | Best sorting Algorithm So the Question is how to sorting an array. In this blog we will cover how to sort anbarray in Javascript.