edu

Government reduces windfall tax on crude oil to ₹5,700 per tonne

The tax, levied as Special Additional Excise Duty (SAED), aims to moderate the impact of rising oil prices on consumers.




edu

Need clear laws, standard operating procedures to protect workers, manufacturers' interests: GTRI

Amid the ongoing Samsung workers’ strike in Tamil Nadu, economic think tank GTRI suggests seven-step strategy to foster a more stable industrial environment in the country




edu

Bharat dal sales resume; chana and masur dal offered at reduced prices

Chana (whole) is being sold at ₹58 per kg and masur dal at ₹89 per kg through cooperative networks like NCCF, NAFED, and Kendriya Bhandar.




edu

Quality education for all is our aim, says A.P. HRD Minister Nara Lokesh




edu

Simple and convenient preconcentration procedure for the isotopic analysis of uranium in seawater

Anal. Methods, 2024, Advance Article
DOI: 10.1039/D3AY01381B, Paper
Minami Abe, Noriaki Seko, Hiroyuki Hoshina, Shigeki Wada, Shinya Yamasaki, Keisuke Sueki, Aya Sakaguchi
Amidoxime adsorbent was synthesised by graft polymerisation. The adsorbent was efficient for collection of U in seawater for both the adsorption and desorption steps, thus affording a new strategy for measurement of U isotopes.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




edu

Discrimination of Diptera order insects based on their saturated cuticular hydrocarbon content using a new microextraction procedure and chromatographic analysis

Anal. Methods, 2024, Accepted Manuscript
DOI: 10.1039/D4AY00214H, Paper
Open Access
Lixy Olinda León-Morán, Marta Pastor-Belda, Pilar Viñas, Natalia Arroyo-Manzanares, María Dolores García, María Isabel Arnaldos, Natalia Campillo
The nature and proportions of hydrocarbons in the cuticle of insects is characteristic of the species and age. Chemical analysis of cuticular hydrocarbons allows species discrimination, which is of great...
The content of this RSS Feed (c) The Royal Society of Chemistry




edu

Pivot to watch: On the U.S. Fed’s rate reduction, its impact




edu

India's climate policies expected to reduce CO2 emissions by around 4 billion tonnes by 2030: Report

The study by Delhi-based independent think tank Council on Energy, Environment and Water (CEEW) said policies for India's power, residential and transport sectors have already saved 440 million tonnes of carbon dioxide (MtCO2) between 2015 and 2020.




edu

ARRL Members Raise $47,000 for STEM Education in Online Auction

ARRL® The National Association for Amateur Radio® is pleased to announce that the 19th annual ARRL Online Auction, sponsored by RT Systems Inc, raised $47,000 for amateur radio STEM education. 

The event was held from October 18- 24, 2024. In addition to hundreds of views, the auction saw 329 individual bidders vying for equipment, vintage books, “mystery junk boxes” from the ARRL Lab, and more....




edu

Family, education, the city all helped me succeed in the US: Indra Nooyi

Former PepsiCo Chairman & CEO Indra Nooyi on her growing up years in Madras and on the mentors in her life




edu

Foreign investors reduce holdings in top 200 companies in March quarter




edu

New bridge to come up across Palar River at Sevilimedu




edu

Five-day special educator training programme to start from November 11

The initiative is being organised by Chennai Volunteers, a social initiative of the Giving Matters Foundation, a not-for-profit organisation, in collaboration with the Portobello Institute, Ireland




edu

Collector forwards complaint against teacher to Education Department




edu

Can Guava, Chikoo, Papaya Reduce Blood Sugar?

rediffGURU Komal Jethmalani, a diabetes expert and dietician, has the answer for you.




edu

5 tips to help you reduce cholesterol

While the causes for high cholesterol are many, there are simple ways to reduce it, says rediffGURU Dr Karthiyayani Mahadevan.




edu

Five Interesting Ways to Use Array.reduce() (And One Boring Way)

Chris Ferdinandi turns the heat down low and lets the sauce reduce while we take a look at how to add spice to our source with a sprinkling of Array.reduce(). Just a little ingenuity with the humblest of functions.


Of all the modern array methods, the one I had the hardest time wrapping my head around was Array.reduce().

On the surface, it seems like a simple, boring method that doesn’t do much. But below its humble exterior, Array.reduce() is actually a powerful, flexible addition to your developer toolkit.

Today, we’re going to look at some cool things you can do with Array.reduce().

How Array.reduce() works

Most of the modern array methods return a new array. The Array.reduce() method is a bit more flexible. It can return anything. Its purpose is to take an array and condense its content into a single value.

That value can be a number, a string, or even an object or new array. That’s the part that’s always tripped me up – I didn’t realize just how flexible it is!

The syntax

The Array.reduce() accepts two arguments: a callback method to run against each item in the array, and a starting value.

The callback also accepts two arguments: the accumulator, which is the current combined value, and the current item in the loop. Whatever you return is used as the accumulator for the next item in the loop. On the very first loop, that starting value is used instead.

var myNewArray = [].reduce(function (accumulator, current) {
  return accumulator;
}, starting);

Let’s look at some examples to make this all tangible.

1. Adding numbers together

Let’s say you had an array of numbers that you wanted to add together. Using Array.forEach(), you might do something like this:

var total = 0;

[1, 2, 3].forEach(function (num) {
  total += num;
});

This is the cliche example for using Array.reduce(). I find the word accumulator confusing, so in this example, I’m calling it sum, because that’s what it is.

var total = [1, 2, 3].reduce(function (sum, current) {
  return sum + current;
}, 0);

Here, we pass in 0 as our starting value.

In the callback, we add the current value to the sum, which has our starting value of 0 on the first loop, then 1 (the starting value of 0 plus the item value of 1), then 3 (the sum value of 1 plus the item value of 2), and so on.

Here’s a demo.

2. Combining multiple array methods into Array.map() and Array.filter() into a single step

Imagine you had an array of wizards at Hogwarts.

var wizards = [
  {
    name: 'Harry Potter',
    house: 'Gryfindor'
  },
  {
    name: 'Cedric Diggory',
    house: 'Hufflepuff'
  },
  {
    name: 'Tonks',
    house: 'Hufflepuff'
  },
  {
    name: 'Ronald Weasley',
    house: 'Gryfindor'
  },
  {
    name: 'Hermione Granger',
    house: 'Gryfindor'
  }
];

You want to create a new array that contains just the names of wizards who are in Hufflepuff. One way you could do that is by using the Array.filter() method to get back just wizards whose house property is Hufflepuff. Then, you’d use the Array.map() method to create a new array containing just the name property for the remaining wizards.

// Get the names of the wizards in Hufflepuff
var hufflepuff = wizards.filter(function (wizard) {
  return wizard.house === 'Hufflepuff';
}).map(function (wizard) {
  return wizard.name;
});

With the Array.reduce() method, we can get the same array in a single pass, improving our performance. You pass in an empty array ([]) as the starting value. On each pass, you check to see if the wizard.house is Hufflepuff. If it is, you push it to the newArr (our accumulator in this example). If not, you do nothing.

Either way, you return the newArr to become the accumulator on the next pass.

// Get the names of the wizards in Hufflepuff
var hufflepuff = wizards.reduce(function (newArr, wizard) {
  if (wizard.house === 'Hufflepuff') {
    newArr.push(wizard.name);
  }
  return newArr;
}, []);

Here’s another demo.

3. Creating markup from an array

What if, instead of creating an array of names, we wanted to create an unordered list of wizards in Hufflepuff? Instead of passing an empty array into Array.reduce() as our starting value, we’ll pass in an empty string ('') and call it html.

If the wizard.house equals Hufflepuff, we’ll concatenate our html string with the wizard.name wrapped in an opening and closing list item (li). Then, we’ll return the html to become the accumulator on the next loop.

// Create a list of wizards in Hufflepuff
var hufflepuffList = wizards.reduce(function (html, wizard) {
  if (wizard.house === 'Hufflepuff') {
    html += '<li>' + wizard.name + '</li>';
  }
  return html;
}, '');

Add an opening and closing unordered list element before and after Array.reduce(), and you’re ready to inject your markup string into the DOM.

// Create a list of wizards in Hufflepuff
var hufflepuffList = '<ul>' + wizards.reduce(function (html, wizard) {
  if (wizard.house === 'Hufflepuff') {
    html += '<li>' + wizard.name + '</li>';
  }
  return html;
}, '') + '</ul>';

See it in action here.

4. Grouping similar items in an array together

The lodash library has a groupBy() method takes a collection of items as an array and groups them together into an object based on some criteria.

Let’s say you want an array of numbers.

If you wanted to group all of the items in numbers together based on their integer value, you would do this with lodash.

var numbers = [6.1, 4.2, 6.3];

// returns {'4': [4.2], '6': [6.1, 6.3]}
_.groupBy(numbers, Math.floor);

If you had an array of words, and you wanted to group the items in words by their length, you would do this.

var words = ['one', 'two', 'three'];

// returns {'3': ['one', 'two'], '5': ['three']}
_.groupBy(words, 'length');

Creating a groupBy() function with Array.reduce()

You can recreate that same functionality using the Array.reduce() method.

We’ll create a helper function, groupBy(), that accepts the array and criteria to sort by as arguments. Inside groupBy(), we’ll run Array.reduce() on our array, passing in an empty object ({}) as our starting point, and return the result.

var groupBy = function (arr, criteria) {
  return arr.reduce(function (obj, item) {
    // Some code will go here...
  }, {});
};

Inside the Array.reduce() callback function, we’ll check to see if the criteria is a function, or a property of the item. Then we’ll get its value from the current item.

If there’s no property in the obj with that value yet, we’ll create it and assign an empty array as its value. Finally, we’ll push the item to that key, and return the object as the accumulator for the next loop.

var groupBy = function (arr, criteria) {
  return arr.reduce(function (obj, item) {

    // Check if the criteria is a function to run on the item or a property of it
    var key = typeof criteria === 'function' ? criteria(item) : item[criteria];

    // If the key doesn't exist yet, create it
    if (!obj.hasOwnProperty(key)) {
      obj[key] = [];
    }

    // Push the value to the object
    obj[key].push(item);

    // Return the object to the next item in the loop
    return obj;

  }, {});
};

Here’s a demo of the completed helper function.

Special thanks to Tom Bremer for helping me make some improvements to this one. You can find this helper function and more like it on the Vanilla JS Toolkit.

5. Combining data from two sources into an array

Remember our array of wizards?

var wizards = [
  {
    name: 'Harry Potter',
    house: 'Gryfindor'
  },
  {
    name: 'Cedric Diggory',
    house: 'Hufflepuff'
  },
  {
    name: 'Tonks',
    house: 'Hufflepuff'
  },
  {
    name: 'Ronald Weasley',
    house: 'Gryfindor'
  },
  {
    name: 'Hermione Granger',
    house: 'Gryfindor'
  }
];

What if you had another data set, an object of house points each wizard has earned.

var points = {
  HarryPotter: 500,
  CedricDiggory: 750,
  RonaldWeasley: 100,
  HermioneGranger: 1270
};

Imagine you wanted to combine both sets of data into a single array, with the number of points added to each wizard’s data in the wizards array. How would you do it?

The Array.reduce() method is perfect for this!

var wizardsWithPoints = wizards.reduce(function (arr, wizard) {

  // Get the key for the points object by removing spaces from the wizard's name
  var key = wizard.name.replace(' ', '');

  // If the wizard has points, add them
  // Otherwise, set them to 0
  if (points[key]) {
    wizard.points = points[key];
  } else {
    wizard.points = 0;
  }

  // Push the wizard object to the new array
  arr.push(wizard);

  // Return the array
  return arr;

}, []);

Here’s a demo combining data from two sources into an array.

6. Combining data from two sources into an object

What if you instead wanted to combine the two data sources into an object, where each wizard’s name was the key, and their house and points were properties? Again, the Array.reduce() method is perfect for this.

var wizardsAsAnObject = wizards.reduce(function (obj, wizard) {

  // Get the key for the points object by removing spaces from the wizard's name
  var key = wizard.name.replace(' ', '');

  // If the wizard has points, add them
  // Otherwise, set them to 0
  if (points[key]) {
    wizard.points = points[key];
  } else {
    wizard.points = 0;
  }

  // Remove the name property
  delete wizard.name;

  // Add wizard data to the new object
  obj[key] = wizard;

  // Return the array
  return obj;

}, {});

Here’s a demo combining two data sets into an object.

Should you use Array.reduce() more?

The Array.reduce() method has gone from being something I thought was pointless to my favorite JavaScript method. So, should you use it? And when?

The Array.reduce() method has fantastic browser support. It works in all modern browsers, and IE9 and above. It’s been supported in mobile browsers for a long time, too. If you need to go back even further than that, you can add a polyfill to push support back to IE6.

The biggest complaint you can make about Array.reduce() is that it’s confusing for people who have never encountered it before. Combining Array.filter() with Array.map() is slower to run and involves extra steps, but it’s easier to read. It’s obvious from the names of the methods what they’re supposed to be doing.

That said, there are times where Array.reduce() makes things that would be complicated more simple rather than more complicated. The groupBy() helper function is a good example.

Ultimately, this is another tool to add to your toolkit. A tool that, if used right, can give you super powers.


About the author

Chris Ferdinandi helps people learn vanilla JavaScript. He believes there’s a simpler, more resilient way to make things for the web.

Chris is the author of the Vanilla JS Pocket Guide series, creator of the Vanilla JS Academy training program, and host of the Vanilla JS Podcast. His developer tips newsletter is read by thousands of developers each weekday.

He’s taught developers at organizations like Chobani and the Boston Globe, and his JavaScript plugins have been used used by Apple and Harvard Business School. Chris Coyier, the founder of CSS-Tricks and CodePen, has described his writing as “infinitely quote-worthy.”

Chris loves pirates, puppies, and Pixar movies, and lives near horse farms in rural Massachusetts. He runs Go Make Things with Bailey Puppy, a lab-mix from Tennessee.

More articles by Chris




edu

Editorial. Skilling sops useful, but education is key

There can be no getting away from the fact that the skills crisis in India’s young (15-29 years) reflects a failure of the education system — and the best skilling efforts cannot make up for this lack




edu

Indian Bank posts 36% rise in Q2 net at ₹2,707 crore on the back of reduced slippages

For the first half of the fiscal, the bank’s net profit exceeded ₹5,000 crore, totalling ₹5,110 crore, up from ₹3,697 crore



  • Money &amp; Banking

edu

Reflections on Practice : Harm Reduction / directed by: Nettie Wild ; production agencies: British Columbia Centre for Disease Control. Street Nurse Program (Vancouver), National Film Board of Canada (Montreal)

Montreal : National Film Board of Canada, 2019




edu

Andhra Pradesh Budget highlights: ₹29,909 crore for school education, ₹16,739 crore for Panchayat Raj and Rural Development for FY25

The Andhra Pradesh Government presented its Budget with an outlay of ₹2,94,427.25 crore for the Financial Year 2024-25; revenue expenditure is estimated at ₹2,35,916.99 crore, and capital expenditure at ₹32,712.84 crore




edu

Towards a coherent education policy

The Chandrababu Naidu government is introducing measures to improve learning outcomes




edu

Fuchsian reduction [electronic resource] : applications to geometry, cosmology and mathematical physics / Satyanad Kichenassamy

Boston : Birkhauser, 2007




edu

KSRTC directed to return penal interest deducted from retirement benefit




edu

Delhi’s challenges in school education

Absenteeism, discriminatory policies, and poor infrastructure are major issues




edu

Online education: How Gen Z and millennials can leverage it for career growth

Transformative online education in India for Gen Z and millennials, driving growth and innovation, faces challenges of inclusivity and credibility.




edu

What will be the impact of AI on Engineering education?

Musing on the pros and cons of what the new technological developments may mean for the teaching-learning process in India




edu

How to bridge the gap between Engineering education and practice

Engineering education needs to go beyond the classroom if the students are to succeed in the real world




edu

News from the world of education - October 29, 2024

Information for students on admissions, new courses, scholarships, convocations, research studies and other news from educational institutions




edu

How to reduce the burden of entrance exams on students

Early preparation, counselling and changes in entrance exams can reduce the burden on students




edu

News from the world of education - November 4, 2024

Information on entrance exams, admissions, new courses, scholarships, research studies and other news from educational institutions




edu

Yarlagadda donates for Hindi students’ educational tour




edu

Cabinet approves PM-Vidyalaxmi scheme for higher education

Under the scheme, a student who secures admission in top higher education institutions, both government and private, will be eligible to get collateral-free, guarantor-free loan from banks and financial institutions




edu

NEP 2020: Michel Danino advocates ‘complete overhaul’ of school education

The Hindu’s webinar discusses NEP 2020’s changes in Indian education with prominent educationists.




edu

NEP 2020 in Odisha: After cautious Naveen, Majhi is on fast track for higher education

Odisha BJP government fast-tracks National Education Policy-2020 implementation in higher education sector, addressing infrastructure, faculty, and internship challenges.




edu

Curriculum content is same across education boards: CISCE chief

He speaks with The Hindu regarding misconceptions about the school board, using technology to beat malpractices, and his plans to improve the quality of school education




edu

News from the world of education - November 9, 2024

Information on new courses, entrance exams, admissions, scholarships, research studies, and other events from educational institutions




edu

Need for a balanced approach in higher education

While many reforms have been introduced in higher education, a recalibration of learning ecosystems is necessary for students to reach their full potential




edu

Higher education students of madrassas face uncertain future after Supreme Court order

The Madrasa Board proposed to the government to accommodate the students of its Kamil and Fazil courses, but no decision was taken on it; about 25,000 students are studying in the Kamil and Fazil courses currently




edu

Emerging trends in Public Policy Education in India

With Public Policy education evolving in India, there is an immediate need to adopt a more comprehensive and practical mode of teaching and learning.




edu

Odisha BJP government announces implementation of NEP-2020 in higher education




edu

‘Zero-error entrance test:’ Union Education Minister urges support from states for exam reforms




edu

L&T Construction reduces timelines by 50% with 3D printing technology

‘By using this technology, a villa project that would typically take 24 to 36 months can be completed in 12 months’




edu

Cobalt-catalyzed enantioselective reductive addition of ketimine with cyclopropyl chloride to construct chiral amino esters bearing cyclopropyl fragments

Org. Chem. Front., 2024, 11,6311-6318
DOI: 10.1039/D4QO01474J, Research Article
Jiangtao Hu, Tingting Xia, Xianqing Wu, Hongrui Feng, Jingping Qu, Yifeng Chen
Co-catalyzed asymmetric reductive addition of ketimine with cyclopropyl chloride has been realized to access diverse chiral amino esters bearing cyclopropyl fragments with broad functional group tolerance and excellent enantioselectivities.
The content of this RSS Feed (c) The Royal Society of Chemistry




edu

Nickel-catalyzed reductive 1,2-alkylarylation of alkenes via a 1,5-hydrogen atom transfer (HAT) cascade

Org. Chem. Front., 2024, Advance Article
DOI: 10.1039/D4QO01875C, Research Article
Xi Chen, Qiang Wang, Xiao-Ping Gong, Rui-Qiang Jiao, Xue-Yuan Liu, Yong-Min Liang
A nickel-catalyzed 1,2-alkylarylation of alkenes has been developed, leveraging amidyl radical-triggered 1,5-HAT with electrophiles as functionalizing reagents.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




edu

Mahabubnagar District Education Officer in ACB net




edu

Mental health and resilience in higher education institutions as a mission 

A two-day conclave started at IIT Hyderabad with an aim to foster healthy and harmonious environment in higher education institutions with the goal of reducing suicide rates and enhancing student and faculty wellbeing




edu

Superior low temperature activity over α-MnO2/β-MnOOH catalyst for selective catalytic reduction of NOx with ammonia

RSC Adv., 2024, 14,35498-35504
DOI: 10.1039/D4RA05934D, Paper
Open Access
Masanori Takemoto, Haruko Fujinuma, Yoshihiro Sugawara, Yukichi Sasaki, Kenta Iyoki, Tatsuya Okubo, Kazuya Yamaguchi, Toru Wakihara
α-MnO2/β-MnOOH catalysts were synthesized by post-synthetic planetary ball milling for OMS-2, enhancing catalytic activity in low-temperature NH3-SCR.
The content of this RSS Feed (c) The Royal Society of Chemistry




edu

From e-waste to eco-sensors: synthesis of reduced graphene oxide/ZnO from discarded batteries for a rapid electrochemical bisphenol A sensor

RSC Adv., 2024, 14,36073-36083
DOI: 10.1039/D4RA04046E, Paper
Open Access
Md Humayun Kabir, Md Yeasin Pabel, Nishat Tasnim Bristy, Md. Abdus Salam, Muhammad Shahriar Bashar, Sabina Yasmin
E-waste-derived reduced graphene oxide/ZnO forfast electrochemical detection of bisphenol A (BPA).
The content of this RSS Feed (c) The Royal Society of Chemistry




edu

A safe and efficient synthesis of N-Boc-β3-amino acid methyl esters from α-amino acids: applications in the formal synthesis of sedum alkaloids

RSC Adv., 2024, 14,36016-36021
DOI: 10.1039/D4RA07506D, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Bohua Long, Lijie Ren, Mengmeng Jiang, Shengquan Hu, Qianqian Jiang, Limin Li, Xuanluan Chen, Zhengzhi Wu
β3-Amino acids are essential components in the synthesis of biologically active compounds.
The content of this RSS Feed (c) The Royal Society of Chemistry